diff mbox series

[v2,23/39] xen/riscv: introduce asm/guest_access.h

Message ID 7dda759b846003fcb453f1118cefbfd2eeb804d7.1700761381.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Enable build of full Xen for RISC-V | expand

Commit Message

Oleksii Kurochko Nov. 24, 2023, 10:30 a.m. UTC
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V2:
 - change xen/mm.h to xen/types.h
---
 xen/arch/riscv/include/asm/guest_access.h | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 xen/arch/riscv/include/asm/guest_access.h

Comments

Jan Beulich Dec. 14, 2023, 2:06 p.m. UTC | #1
On 24.11.2023 11:30, Oleksii Kurochko wrote:
> --- /dev/null
> +++ b/xen/arch/riscv/include/asm/guest_access.h
> @@ -0,0 +1,29 @@
> +#ifndef __ASM_RISCV_GUEST_ACCESS_H__
> +#define __ASM_RISCV_GUEST_ACCESS_H__
> +
> +#include <xen/types.h>
> +
> +unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
> +unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);

For the full build to work, you will need to implement these somewhere.
From the titles of further patches I can't guess where that would be.
Note how PPC has decided to have these be inline dummies for the time
being. It also looks as if you would also need raw_clear_guest()?

> +#define __raw_copy_to_guest raw_copy_to_guest
> +#define __raw_copy_from_guest raw_copy_from_guest
> +
> +#define guest_handle_okay(hnd, nr) (1)
> +#define guest_handle_subrange_okay(hnd, first, last) (1)

Arm has a comment next to these (actually two, I mean the latter), which
I think would be sensible to also have here.

> +struct domain;
> +unsigned long copy_to_guest_phys(struct domain *d,
> +                                 paddr_t gpa,
> +                                 void *buf,
> +                                 unsigned int len);

You don't need this just yet, do you?

Jan
Oleksii Kurochko Dec. 18, 2023, 10:02 a.m. UTC | #2
On Thu, 2023-12-14 at 15:06 +0100, Jan Beulich wrote:
> On 24.11.2023 11:30, Oleksii Kurochko wrote:
> > --- /dev/null
> > +++ b/xen/arch/riscv/include/asm/guest_access.h
> > @@ -0,0 +1,29 @@
> > +#ifndef __ASM_RISCV_GUEST_ACCESS_H__
> > +#define __ASM_RISCV_GUEST_ACCESS_H__
> > +
> > +#include <xen/types.h>
> > +
> > +unsigned long raw_copy_to_guest(void *to, const void *from,
> > unsigned len);
> > +unsigned long raw_copy_from_guest(void *to, const void *from,
> > unsigned len);
> 
> For the full build to work, you will need to implement these
> somewhere.
> From the titles of further patches I can't guess where that would be.
> Note how PPC has decided to have these be inline dummies for the time
> being. It also looks as if you would also need raw_clear_guest()?
It is implemented in xen/arch/riscv/stubs.c:362,367.
Regarding raw_clear_guest() I'll double check. I don't have a
compilation issue with it, so I ignored this macros.

> > +#define __raw_copy_to_guest raw_copy_to_guest
> > +#define __raw_copy_from_guest raw_copy_from_guest
> > +
> > +#define guest_handle_okay(hnd, nr) (1)
> > +#define guest_handle_subrange_okay(hnd, first, last) (1)
> 
> Arm has a comment next to these (actually two, I mean the latter),
> which
> I think would be sensible to also have here.
Thanks. I'll add the comment.

> 
> > +struct domain;
> > +unsigned long copy_to_guest_phys(struct domain *d,
> > +                                 paddr_t gpa,
> > +                                 void *buf,
> > +                                 unsigned int len);
> 
> You don't need this just yet, do you?
Yes, you are right. This function isn't needed for now.

Thanks. I'll drop it.

~ Oleksii
Jan Beulich Dec. 18, 2023, 10:10 a.m. UTC | #3
On 18.12.2023 11:02, Oleksii wrote:
> On Thu, 2023-12-14 at 15:06 +0100, Jan Beulich wrote:
>> On 24.11.2023 11:30, Oleksii Kurochko wrote:
>>> --- /dev/null
>>> +++ b/xen/arch/riscv/include/asm/guest_access.h
>>> @@ -0,0 +1,29 @@
>>> +#ifndef __ASM_RISCV_GUEST_ACCESS_H__
>>> +#define __ASM_RISCV_GUEST_ACCESS_H__
>>> +
>>> +#include <xen/types.h>
>>> +
>>> +unsigned long raw_copy_to_guest(void *to, const void *from,
>>> unsigned len);
>>> +unsigned long raw_copy_from_guest(void *to, const void *from,
>>> unsigned len);
>>
>> For the full build to work, you will need to implement these
>> somewhere.
>> From the titles of further patches I can't guess where that would be.
>> Note how PPC has decided to have these be inline dummies for the time
>> being. It also looks as if you would also need raw_clear_guest()?
> It is implemented in xen/arch/riscv/stubs.c:362,367.

Ah, that's patch 37, which I didn't get to yet.

Jan

> Regarding raw_clear_guest() I'll double check. I don't have a
> compilation issue with it, so I ignored this macros.
diff mbox series

Patch

diff --git a/xen/arch/riscv/include/asm/guest_access.h b/xen/arch/riscv/include/asm/guest_access.h
new file mode 100644
index 0000000000..122ecdc048
--- /dev/null
+++ b/xen/arch/riscv/include/asm/guest_access.h
@@ -0,0 +1,29 @@ 
+#ifndef __ASM_RISCV_GUEST_ACCESS_H__
+#define __ASM_RISCV_GUEST_ACCESS_H__
+
+#include <xen/types.h>
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
+unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
+
+#define __raw_copy_to_guest raw_copy_to_guest
+#define __raw_copy_from_guest raw_copy_from_guest
+
+#define guest_handle_okay(hnd, nr) (1)
+#define guest_handle_subrange_okay(hnd, first, last) (1)
+
+struct domain;
+unsigned long copy_to_guest_phys(struct domain *d,
+                                 paddr_t gpa,
+                                 void *buf,
+                                 unsigned int len);
+
+#endif /* __ASM_RISCV_GUEST_ACCESS_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */