diff mbox series

[08/10] hw/arm/virt: Fix devicetree warnings about the GPIO node

Message ID 20220824155113.286730-9-jean-philippe@linaro.org (mailing list archive)
State New, archived
Headers show
Series hw/arm/virt: Fix dt-schema warnings | expand

Commit Message

Jean-Philippe Brucker Aug. 24, 2022, 3:51 p.m. UTC
The GPIO devicetree node is missing "interrupt-controller" and
"#interrupt-cells" properties:

  pl061@9030000: 'interrupt-controller' is a required property
  From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml
  pl061@9030000: '#interrupt-cells' is a required property
  From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml

Signed-off-by: Jean-Philippe Brucker <jean-philippe@linaro.org>
---
 hw/arm/virt.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Peter Maydell Aug. 24, 2022, 7:48 p.m. UTC | #1
On Wed, 24 Aug 2022 at 16:51, Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> The GPIO devicetree node is missing "interrupt-controller" and
> "#interrupt-cells" properties:
>
>   pl061@9030000: 'interrupt-controller' is a required property
>   From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml
>   pl061@9030000: '#interrupt-cells' is a required property
>   From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml

Why? This is a GPIO controller, not an interrupt controller.
It seems wrong to be advertising in the dtb that it is.

thanks
-- PMM
Jean-Philippe Brucker Sept. 1, 2022, 2:59 p.m. UTC | #2
On Wed, Aug 24, 2022 at 08:48:26PM +0100, Peter Maydell wrote:
> On Wed, 24 Aug 2022 at 16:51, Jean-Philippe Brucker
> <jean-philippe@linaro.org> wrote:
> >
> > The GPIO devicetree node is missing "interrupt-controller" and
> > "#interrupt-cells" properties:
> >
> >   pl061@9030000: 'interrupt-controller' is a required property
> >   From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml
> >   pl061@9030000: '#interrupt-cells' is a required property
> >   From schema: linux/Documentation/devicetree/bindings/gpio/pl061-gpio.yaml
> 
> Why? This is a GPIO controller, not an interrupt controller.
> It seems wrong to be advertising in the dtb that it is.

pl061 can be used as an interrupt controller, and I think it's wired that
way, with GPIO key acting as an interrupt source. I'll add this to the
commit message.

Thanks,
Jean
diff mbox series

Patch

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 952af37935..779eb5ea31 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1012,6 +1012,8 @@  static void create_gpio_devices(const VirtMachineState *vms, int gpio,
     qemu_fdt_setprop_cell(ms->fdt, nodename, "clocks", vms->clock_phandle);
     qemu_fdt_setprop_string(ms->fdt, nodename, "clock-names", "apb_pclk");
     qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", phandle);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 2);
+    qemu_fdt_setprop(ms->fdt, nodename, "interrupt-controller", NULL, 0);
 
     if (gpio != VIRT_GPIO) {
         /* Mark as not usable by the normal world */