Re: [RFC/PATCH v1 07/11] gunyah: Specify device-tree location

2024-01-10 Thread Alex Bennée
Srivatsa Vaddagiri  writes:

> * Philippe Mathieu-Daud?  [2024-01-09 14:31:03]:
>
>> Hi Srivatsa,
>> 
>> On 9/1/24 10:00, Srivatsa Vaddagiri wrote:
>> > Specify the location of device-tree and its size, as Gunyah requires the
>> > device-tree to be parsed before VM can begin its execution.
>> > 
>> > Signed-off-by: Srivatsa Vaddagiri 
>> > ---
>> >   MAINTAINERS   |  1 +
>> >   accel/stubs/gunyah-stub.c |  5 +
>> >   hw/arm/virt.c |  6 ++
>> >   include/sysemu/gunyah.h   |  2 ++
>> >   target/arm/gunyah.c   | 45 +++
>> >   target/arm/meson.build|  3 +++
>> >   6 files changed, 62 insertions(+)
>> >   create mode 100644 target/arm/gunyah.c
>> 
>> (Please enable scripts/git.orderfile)
>
> Sure will do so from the next version!
>
>> 
>> > diff --git a/include/sysemu/gunyah.h b/include/sysemu/gunyah.h
>> > index 4f26938521..a73d17bfb9 100644
>> > --- a/include/sysemu/gunyah.h
>> > +++ b/include/sysemu/gunyah.h
>> > @@ -27,4 +27,6 @@ typedef struct GUNYAHState GUNYAHState;
>> >   DECLARE_INSTANCE_CHECKER(GUNYAHState, GUNYAH_STATE,
>> >TYPE_GUNYAH_ACCEL)
>> > +int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
>> I'm getting:
>> 
>> In file included from hw/intc/arm_gicv3_common.c:35:
>> include/sysemu/gunyah.h:30:24: error: unknown type name '__u64'
>> int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
>>^
>> include/sysemu/gunyah.h:30:41: error: unknown type name '__u64'
>> int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
>> ^
>> 2 errors generated.
>
> Hmm I don't get that error when compiling on Linux. I think uint64_t will work
> better for all platforms where Qemu can get compiled?

Yes, aside from imported headers we state:

  In the event that you require a specific width, use a standard type
  like int32_t, uint32_t, uint64_t, etc.  The specific types are
  mandatory for VMState fields.

  Don't use Linux kernel internal types like u32, __u32 or __le32.

in style.rst

>
> - vatsa

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



Re: [RFC/PATCH v1 07/11] gunyah: Specify device-tree location

2024-01-10 Thread Srivatsa Vaddagiri
* Philippe Mathieu-Daud?  [2024-01-09 14:36:12]:

> > +#include "qemu/osdep.h"
> > +#include "qemu/error-report.h"
> > +#include "sysemu/gunyah.h"
> > +#include "sysemu/gunyah_int.h"
> > +#include "linux-headers/linux/gunyah.h"
> I'm getting on macOS:
> 
> In file included from ../../target/arm/gunyah.c:13:
> linux-headers/linux/gunyah.h:13:10: fatal error: 'linux/types.h' file not
> found
> #include 
>  ^~~
> 1 error generated.
> 
> Maybe we need the following change?
> 
> -- >8 --
> diff --git a/meson.build b/meson.build
> index 6ded60063e..fb20ca04d1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -712,5 +712,5 @@ endif
> 
>  gunyah = not_found
> -if get_option('gunyah').allowed()
> +if get_option('gunyah').allowed() and host_os == 'linux'
>  accelerators += 'CONFIG_GUNYAH'
>  endif

Ok sure will include that change in my next version.

- vatsa



Re: [RFC/PATCH v1 07/11] gunyah: Specify device-tree location

2024-01-10 Thread Srivatsa Vaddagiri
* Philippe Mathieu-Daud?  [2024-01-09 14:31:03]:

> Hi Srivatsa,
> 
> On 9/1/24 10:00, Srivatsa Vaddagiri wrote:
> > Specify the location of device-tree and its size, as Gunyah requires the
> > device-tree to be parsed before VM can begin its execution.
> > 
> > Signed-off-by: Srivatsa Vaddagiri 
> > ---
> >   MAINTAINERS   |  1 +
> >   accel/stubs/gunyah-stub.c |  5 +
> >   hw/arm/virt.c |  6 ++
> >   include/sysemu/gunyah.h   |  2 ++
> >   target/arm/gunyah.c   | 45 +++
> >   target/arm/meson.build|  3 +++
> >   6 files changed, 62 insertions(+)
> >   create mode 100644 target/arm/gunyah.c
> 
> (Please enable scripts/git.orderfile)

Sure will do so from the next version!

> 
> > diff --git a/include/sysemu/gunyah.h b/include/sysemu/gunyah.h
> > index 4f26938521..a73d17bfb9 100644
> > --- a/include/sysemu/gunyah.h
> > +++ b/include/sysemu/gunyah.h
> > @@ -27,4 +27,6 @@ typedef struct GUNYAHState GUNYAHState;
> >   DECLARE_INSTANCE_CHECKER(GUNYAHState, GUNYAH_STATE,
> >TYPE_GUNYAH_ACCEL)
> > +int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
> I'm getting:
> 
> In file included from hw/intc/arm_gicv3_common.c:35:
> include/sysemu/gunyah.h:30:24: error: unknown type name '__u64'
> int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
>^
> include/sysemu/gunyah.h:30:41: error: unknown type name '__u64'
> int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
> ^
> 2 errors generated.

Hmm I don't get that error when compiling on Linux. I think uint64_t will work
better for all platforms where Qemu can get compiled?

- vatsa



Re: [RFC/PATCH v1 07/11] gunyah: Specify device-tree location

2024-01-09 Thread Philippe Mathieu-Daudé

On 9/1/24 10:00, Srivatsa Vaddagiri wrote:

Specify the location of device-tree and its size, as Gunyah requires the
device-tree to be parsed before VM can begin its execution.

Signed-off-by: Srivatsa Vaddagiri 
---
  MAINTAINERS   |  1 +
  accel/stubs/gunyah-stub.c |  5 +
  hw/arm/virt.c |  6 ++
  include/sysemu/gunyah.h   |  2 ++
  target/arm/gunyah.c   | 45 +++
  target/arm/meson.build|  3 +++
  6 files changed, 62 insertions(+)
  create mode 100644 target/arm/gunyah.c




diff --git a/target/arm/gunyah.c b/target/arm/gunyah.c
new file mode 100644
index 00..73c1c2a88a
--- /dev/null
+++ b/target/arm/gunyah.c
@@ -0,0 +1,45 @@
+/*
+ * QEMU Gunyah hypervisor support
+ *
+ * Copyright(c) 2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/error-report.h"
+#include "sysemu/gunyah.h"
+#include "sysemu/gunyah_int.h"
+#include "linux-headers/linux/gunyah.h"

I'm getting on macOS:

In file included from ../../target/arm/gunyah.c:13:
linux-headers/linux/gunyah.h:13:10: fatal error: 'linux/types.h' file 
not found

#include 
 ^~~
1 error generated.

Maybe we need the following change?

-- >8 --
diff --git a/meson.build b/meson.build
index 6ded60063e..fb20ca04d1 100644
--- a/meson.build
+++ b/meson.build
@@ -712,5 +712,5 @@ endif

 gunyah = not_found
-if get_option('gunyah').allowed()
+if get_option('gunyah').allowed() and host_os == 'linux'
 accelerators += 'CONFIG_GUNYAH'
 endif
---




Re: [RFC/PATCH v1 07/11] gunyah: Specify device-tree location

2024-01-09 Thread Philippe Mathieu-Daudé

Hi Srivatsa,

On 9/1/24 10:00, Srivatsa Vaddagiri wrote:

Specify the location of device-tree and its size, as Gunyah requires the
device-tree to be parsed before VM can begin its execution.

Signed-off-by: Srivatsa Vaddagiri 
---
  MAINTAINERS   |  1 +
  accel/stubs/gunyah-stub.c |  5 +
  hw/arm/virt.c |  6 ++
  include/sysemu/gunyah.h   |  2 ++
  target/arm/gunyah.c   | 45 +++
  target/arm/meson.build|  3 +++
  6 files changed, 62 insertions(+)
  create mode 100644 target/arm/gunyah.c


(Please enable scripts/git.orderfile)


diff --git a/include/sysemu/gunyah.h b/include/sysemu/gunyah.h
index 4f26938521..a73d17bfb9 100644
--- a/include/sysemu/gunyah.h
+++ b/include/sysemu/gunyah.h
@@ -27,4 +27,6 @@ typedef struct GUNYAHState GUNYAHState;
  DECLARE_INSTANCE_CHECKER(GUNYAHState, GUNYAH_STATE,
   TYPE_GUNYAH_ACCEL)
  
+int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);

I'm getting:

In file included from hw/intc/arm_gicv3_common.c:35:
include/sysemu/gunyah.h:30:24: error: unknown type name '__u64'
int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
   ^
include/sysemu/gunyah.h:30:41: error: unknown type name '__u64'
int gunyah_arm_set_dtb(__u64 dtb_start, __u64 dtb_size);
^
2 errors generated.