Date: Fri, 23 Sep 2022 15:46:45 +0100 From: Andrew Turner <andrew@FreeBSD.org> To: Jessica Clarke <jrtc27@freebsd.org> Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: e13c6a6fca71 - main - Teach the GICv3 driver about a vgic child Message-ID: <BD5DB3A1-10A4-4144-985A-0C434F501D69@FreeBSD.org> In-Reply-To: <1C9075B5-7757-467D-AE61-33AB45DEBB2D@freebsd.org> References: <202209211000.28LA00ck091449@gitrepo.freebsd.org> <1C9075B5-7757-467D-AE61-33AB45DEBB2D@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_D48D8010-9C1C-4854-8E75-50154E0EED7B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On 21 Sep 2022, at 15:10, Jessica Clarke <jrtc27@freebsd.org> wrote: >=20 > On 21 Sept 2022, at 11:00, Andrew Turner <andrew@FreeBSD.org = <mailto:andrew@FreeBSD.org>> wrote: >>=20 >> The branch main has been updated by andrew: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3De13c6a6fca7177fb9143ce629c2e33b3= 5b6c4219 >>=20 >> commit e13c6a6fca7177fb9143ce629c2e33b35b6c4219 >> Author: Andrew Turner <andrew@FreeBSD.org> >> AuthorDate: 2022-09-14 16:29:29 +0000 >> Commit: Andrew Turner <andrew@FreeBSD.org> >> CommitDate: 2022-09-21 09:59:13 +0000 >>=20 >> Teach the GICv3 driver about a vgic child >>=20 >> This will be used by bhyve to attach a virtual GIC driver. >>=20 >> Sponsored by: Innovate UK >> Sponsored by: The FreeBSD Foundation >> Differential Revision: https://reviews.freebsd.org/D36590 >> --- >> sys/arm/arm/gic_common.h | 2 ++ >> sys/arm64/arm64/gic_v3.c | 7 +++++++ >> sys/arm64/arm64/gic_v3_acpi.c | 36 = ++++++++++++++++++++++++++++++++++-- >> sys/arm64/arm64/gic_v3_fdt.c | 23 ++++++++++++++++++++++- >> sys/arm64/arm64/gic_v3_var.h | 1 + >> 5 files changed, 66 insertions(+), 3 deletions(-) >>=20 >> diff --git a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h >> index 9e8fb19300ca..42ec44bb7fab 100644 >> --- a/sys/arm/arm/gic_common.h >> +++ b/sys/arm/arm/gic_common.h >> @@ -33,6 +33,7 @@ >>=20 >> #define GIC_IVAR_HW_REV 500 >> #define GIC_IVAR_BUS 501 >> +#define GIC_IVAR_VGIC 502 >>=20 >> /* GIC_IVAR_BUS values */ >> #define GIC_BUS_UNKNOWN 0 >> @@ -42,6 +43,7 @@ >>=20 >> __BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int); >> __BUS_ACCESSOR(gic, bus, GIC, BUS, u_int); >> +__BUS_ACCESSOR(gic, vgic, GIC, VGIC, u_int); >>=20 >> /* Software Generated Interrupts */ >> #define GIC_FIRST_SGI 0 /* Irqs 0-15 are = SGIs/IPIs. */ >> diff --git a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c >> index 27f41c58fe92..b4678d95fee5 100644 >> --- a/sys/arm64/arm64/gic_v3.c >> +++ b/sys/arm64/arm64/gic_v3.c >> @@ -456,6 +456,7 @@ static int >> gic_v3_read_ivar(device_t dev, device_t child, int which, uintptr_t = *result) >> { >> struct gic_v3_softc *sc; >> + struct gic_v3_devinfo *di; >>=20 >> sc =3D device_get_softc(dev); >>=20 >> @@ -481,6 +482,12 @@ gic_v3_read_ivar(device_t dev, device_t child, = int which, uintptr_t *result) >> ("gic_v3_read_ivar: Invalid bus type %u", = sc->gic_bus)); >> *result =3D sc->gic_bus; >> return (0); >> + case GIC_IVAR_VGIC: >> + di =3D device_get_ivars(child); >> + if (di =3D=3D NULL) >> + return (EINVAL); >> + *result =3D di->is_vgic; >> + return (0); >> } >>=20 >> return (ENOENT); >> diff --git a/sys/arm64/arm64/gic_v3_acpi.c = b/sys/arm64/arm64/gic_v3_acpi.c >> index cbe4d5989ec2..cc24b7824ff1 100644 >> --- a/sys/arm64/arm64/gic_v3_acpi.c >> +++ b/sys/arm64/arm64/gic_v3_acpi.c >> @@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$"); >> #include "gic_v3_reg.h" >> #include "gic_v3_var.h" >>=20 >> +#define GICV3_PRIV_VGIC 0x80000000 >> +#define GICV3_PRIV_FLAGS 0x80000000 >> + >> struct gic_v3_acpi_devinfo { >> struct gic_v3_devinfo di_gic_dinfo; >> struct resource_list di_rl; >> @@ -86,6 +89,7 @@ struct madt_table_data { >> ACPI_MADT_GENERIC_DISTRIBUTOR *dist; >> int count; >> bool rdist_use_gicc; >> + bool have_vgic; >> }; >>=20 >> static void >> @@ -152,6 +156,8 @@ rdist_map(ACPI_SUBTABLE_HEADER *entry, void *arg) >> BUS_SET_RESOURCE(madt_data->parent, madt_data->dev, >> SYS_RES_MEMORY, madt_data->count, = intr->GicrBaseAddress, >> count); >> + if (intr->VgicInterrupt =3D=3D 0) >> + madt_data->have_vgic =3D false; >>=20 >> default: >> break; >> @@ -164,6 +170,7 @@ gic_v3_acpi_identify(driver_t *driver, device_t = parent) >> struct madt_table_data madt_data; >> ACPI_TABLE_MADT *madt; >> vm_paddr_t physaddr; >> + uintptr_t private; >> device_t dev; >>=20 >> physaddr =3D acpi_find_table(ACPI_SIG_MADT); >> @@ -210,6 +217,7 @@ gic_v3_acpi_identify(driver_t *driver, device_t = parent) >>=20 >> madt_data.dev =3D dev; >> madt_data.rdist_use_gicc =3D false; >> + madt_data.have_vgic =3D true; >> acpi_walk_subtables(madt + 1, (char *)madt + = madt->Header.Length, >> rdist_map, &madt_data); >> if (madt_data.count =3D=3D 0) { >> @@ -222,7 +230,12 @@ gic_v3_acpi_identify(driver_t *driver, device_t = parent) >> rdist_map, &madt_data); >> } >>=20 >> - acpi_set_private(dev, (void = *)(uintptr_t)madt_data.dist->Version); >> + private =3D madt_data.dist->Version; >> + /* Flag that the VGIC is in use */ >> + if (madt_data.have_vgic) >> + private |=3D GICV3_PRIV_VGIC; >> + >> + acpi_set_private(dev, (void *)private); >>=20 >> out: >> acpi_unmap_table(madt); >> @@ -232,7 +245,7 @@ static int >> gic_v3_acpi_probe(device_t dev) >> { >>=20 >> - switch((uintptr_t)acpi_get_private(dev)) { >> + switch((uintptr_t)acpi_get_private(dev) & ~GICV3_PRIV_FLAGS) { >> case ACPI_MADT_GIC_VERSION_V3: >> case ACPI_MADT_GIC_VERSION_V4: >> break; >> @@ -390,9 +403,14 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, = void *arg) >> static void >> gic_v3_acpi_bus_attach(device_t dev) >> { >> + struct gic_v3_acpi_devinfo *di; >> + struct gic_v3_softc *sc; >> ACPI_TABLE_MADT *madt; >> + device_t child; >> vm_paddr_t physaddr; >>=20 >> + sc =3D device_get_softc(dev); >> + >> physaddr =3D acpi_find_table(ACPI_SIG_MADT); >> if (physaddr =3D=3D 0) >> return; >> @@ -405,6 +423,20 @@ gic_v3_acpi_bus_attach(device_t dev) >>=20 >> acpi_walk_subtables(madt + 1, (char *)madt + = madt->Header.Length, >> gic_v3_add_children, dev); >> + /* Add the vgic child if needed */ >> + if (((uintptr_t)acpi_get_private(dev) & GICV3_PRIV_FLAGS) !=3D = 0) { >> + child =3D device_add_child(dev, "vgic", -1); >=20 > Do we have anything to attach to this, or is this just creating > children that will never do anything? This will be used by Bhyve to attach a virtual gic driver so we can use = standard methods to handle interacting with the hardware. Andrew --Apple-Mail=_D48D8010-9C1C-4854-8E75-50154E0EED7B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 21 Sep 2022, at 15:10, Jessica Clarke <<a = href=3D"mailto:jrtc27@freebsd.org" class=3D"">jrtc27@freebsd.org</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta = charset=3D"UTF-8" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">On 21 Sept 2022, at 11:00, Andrew Turner <</span><a = href=3D"mailto:andrew@FreeBSD.org" style=3D"font-family: Helvetica; = font-size: 12px; font-style: normal; font-variant-caps: normal; = font-weight: 400; letter-spacing: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; = -webkit-text-stroke-width: 0px;" class=3D"">andrew@FreeBSD.org</a><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;" class=3D"">> wrote:</span><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; = letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" = class=3D""><blockquote type=3D"cite" style=3D"font-family: Helvetica; = font-size: 12px; font-style: normal; font-variant-caps: normal; = font-weight: 400; letter-spacing: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><br = class=3D"">The branch main has been updated by andrew:<br class=3D""><br = class=3D"">URL: <a = href=3D"https://cgit.FreeBSD.org/src/commit/?id=3De13c6a6fca7177fb9143ce62= 9c2e33b35b6c4219" = class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3De13c6a6fca7177fb9143c= e629c2e33b35b6c4219</a><br class=3D""><br class=3D"">commit = e13c6a6fca7177fb9143ce629c2e33b35b6c4219<br class=3D"">Author: = Andrew Turner <<a = href=3D"mailto:andrew@FreeBSD.org" = class=3D"">andrew@FreeBSD.org</a>><br class=3D"">AuthorDate: = 2022-09-14 16:29:29 +0000<br class=3D"">Commit: = Andrew Turner <<a = href=3D"mailto:andrew@FreeBSD.org" = class=3D"">andrew@FreeBSD.org</a>><br class=3D"">CommitDate: = 2022-09-21 09:59:13 +0000<br class=3D""><br class=3D""> Teach = the GICv3 driver about a vgic child<br class=3D""><br = class=3D""> This will be used by bhyve to attach a virtual = GIC driver.<br class=3D""><br class=3D""> Sponsored by: = Innovate UK<br class=3D""> Sponsored by: = The FreeBSD Foundation<br class=3D""> Differential = Revision: <a href=3D"https://reviews.freebsd.org/D36590" = class=3D"">https://reviews.freebsd.org/D36590</a><br class=3D"">---<br = class=3D"">sys/arm/arm/gic_common.h | = 2 ++<br class=3D"">sys/arm64/arm64/gic_v3.c = | 7 +++++++<br = class=3D"">sys/arm64/arm64/gic_v3_acpi.c | 36 = ++++++++++++++++++++++++++++++++++--<br = class=3D"">sys/arm64/arm64/gic_v3_fdt.c | 23 = ++++++++++++++++++++++-<br class=3D"">sys/arm64/arm64/gic_v3_var.h = | 1 +<br class=3D"">5 files changed, 66 insertions(+), 3 = deletions(-)<br class=3D""><br class=3D"">diff --git = a/sys/arm/arm/gic_common.h b/sys/arm/arm/gic_common.h<br class=3D"">index = 9e8fb19300ca..42ec44bb7fab 100644<br class=3D"">--- = a/sys/arm/arm/gic_common.h<br class=3D"">+++ = b/sys/arm/arm/gic_common.h<br class=3D"">@@ -33,6 +33,7 @@<br = class=3D""><br class=3D"">#define<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>GIC_IVAR_HW_REV<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>500<br = class=3D"">#define<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>GIC_IVAR_BUS<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>501<br class=3D"">+#define<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>GIC_IVAR_VGIC<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span><span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>502<br class=3D""><br class=3D"">/* GIC_IVAR_BUS values = */<br class=3D"">#define<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>GIC_BUS_UNKNOWN<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>0<br = class=3D"">@@ -42,6 +43,7 @@<br class=3D""><br = class=3D"">__BUS_ACCESSOR(gic, hw_rev, GIC, HW_REV, u_int);<br = class=3D"">__BUS_ACCESSOR(gic, bus, GIC, BUS, u_int);<br = class=3D"">+__BUS_ACCESSOR(gic, vgic, GIC, VGIC, u_int);<br class=3D""><br= class=3D"">/* Software Generated Interrupts */<br class=3D"">#define<span= class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>GIC_FIRST_SGI<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span><span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span><span class=3D"Apple-converted-space"> </span>0<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>/* Irqs = 0-15 are SGIs/IPIs. */<br class=3D"">diff --git = a/sys/arm64/arm64/gic_v3.c b/sys/arm64/arm64/gic_v3.c<br class=3D"">index = 27f41c58fe92..b4678d95fee5 100644<br class=3D"">--- = a/sys/arm64/arm64/gic_v3.c<br class=3D"">+++ = b/sys/arm64/arm64/gic_v3.c<br class=3D"">@@ -456,6 +456,7 @@ static = int<br class=3D"">gic_v3_read_ivar(device_t dev, device_t child, int = which, uintptr_t *result)<br class=3D"">{<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>struct = gic_v3_softc *sc;<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>struct gic_v3_devinfo *di;<br = class=3D""><br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>sc =3D device_get_softc(dev);<br = class=3D""><br class=3D"">@@ -481,6 +482,12 @@ gic_v3_read_ivar(device_t = dev, device_t child, int which, uintptr_t *result)<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span> ("gic_v3_re= ad_ivar: Invalid bus type %u", sc->gic_bus));<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>*result =3D= sc->gic_bus;<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>return (0);<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>case = GIC_IVAR_VGIC:<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>di =3D = device_get_ivars(child);<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>if (di =3D=3D NULL)<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>return (EINVAL);<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>*result =3D di->is_vgic;<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>return (0);<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>}<br class=3D""><br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>return (ENOENT);<br class=3D"">diff --git = a/sys/arm64/arm64/gic_v3_acpi.c b/sys/arm64/arm64/gic_v3_acpi.c<br = class=3D"">index cbe4d5989ec2..cc24b7824ff1 100644<br class=3D"">--- = a/sys/arm64/arm64/gic_v3_acpi.c<br class=3D"">+++ = b/sys/arm64/arm64/gic_v3_acpi.c<br class=3D"">@@ -48,6 +48,9 @@ = __FBSDID("$FreeBSD$");<br class=3D"">#include "gic_v3_reg.h"<br = class=3D"">#include "gic_v3_var.h"<br class=3D""><br = class=3D"">+#define<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>GICV3_PRIV_VGIC<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>0x80000000<br = class=3D"">+#define<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>GICV3_PRIV_FLAGS<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>0x80000000<br class=3D"">+<br = class=3D"">struct gic_v3_acpi_devinfo {<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>struct = gic_v3_devinfo<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>di_gic_dinfo;<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>struct resource_list<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>di_rl;<br = class=3D"">@@ -86,6 +89,7 @@ struct madt_table_data {<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>ACPI_MADT_GENERIC_DISTRIBUTOR *dist;<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>int = count;<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>bool rdist_use_gicc;<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>bool = have_vgic;<br class=3D"">};<br class=3D""><br class=3D"">static void<br = class=3D"">@@ -152,6 +156,8 @@ rdist_map(ACPI_SUBTABLE_HEADER *entry, = void *arg)<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> = </span>BUS_SET_RESOURCE(madt_data->parent, madt_data->dev,<br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span = class=3D"Apple-converted-space"> </span> SYS_RES_MEM= ORY, madt_data->count, intr->GicrBaseAddress,<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span> count);<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>if (intr->VgicInterrupt =3D=3D 0)<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>madt_data->have_vgic =3D false;<br class=3D""><br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>default:<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>break;<br class=3D"">@@ -164,6 = +170,7 @@ gic_v3_acpi_identify(driver_t *driver, device_t parent)<br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>struct madt_table_data madt_data;<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>ACPI_TABLE_MADT *madt;<br class=3D""><span class=3D"Apple-tab-span"= style=3D"white-space: pre;"> </span>vm_paddr_t physaddr;<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>uintptr_t private;<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>device_t dev;<br class=3D""><br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>physaddr =3D acpi_find_table(ACPI_SIG_MADT);<br class=3D"">@@ = -210,6 +217,7 @@ gic_v3_acpi_identify(driver_t *driver, device_t = parent)<br class=3D""><br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>madt_data.dev =3D dev;<br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>madt_data.rdist_use_gicc =3D false;<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>madt_data.have_vgic =3D true;<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>acpi_walk_subtables(madt + 1, (char *)madt + = madt->Header.Length,<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span> rdist_map, = &madt_data);<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>if (madt_data.count =3D=3D 0) = {<br class=3D"">@@ -222,7 +230,12 @@ gic_v3_acpi_identify(driver_t = *driver, device_t parent)<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span> rdist_map, = &madt_data);<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>}<br class=3D""><br = class=3D"">-<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>acpi_set_private(dev, (void = *)(uintptr_t)madt_data.dist->Version);<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>private =3D= madt_data.dist->Version;<br class=3D"">+<span class=3D"Apple-tab-span"= style=3D"white-space: pre;"> </span>/* Flag that the VGIC is in use = */<br class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>if (madt_data.have_vgic)<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>private = |=3D GICV3_PRIV_VGIC;<br class=3D"">+<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>acpi_set_private(dev, (void *)private);<br class=3D""><br = class=3D"">out:<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>acpi_unmap_table(madt);<br = class=3D"">@@ -232,7 +245,7 @@ static int<br = class=3D"">gic_v3_acpi_probe(device_t dev)<br class=3D"">{<br = class=3D""><br class=3D"">-<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> = </span>switch((uintptr_t)acpi_get_private(dev)) {<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>switch((uintptr_t)acpi_get_private(dev) & ~GICV3_PRIV_FLAGS) = {<br class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>case ACPI_MADT_GIC_VERSION_V3:<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>case = ACPI_MADT_GIC_VERSION_V4:<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>break;<br class=3D"">@@ -390,9 = +403,14 @@ gic_v3_add_children(ACPI_SUBTABLE_HEADER *entry, void = *arg)<br class=3D"">static void<br = class=3D"">gic_v3_acpi_bus_attach(device_t dev)<br class=3D"">{<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>struct gic_v3_acpi_devinfo *di;<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>struct = gic_v3_softc *sc;<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>ACPI_TABLE_MADT *madt;<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>device_t child;<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>vm_paddr_t physaddr;<br = class=3D""><br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>sc =3D device_get_softc(dev);<br = class=3D"">+<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>physaddr =3D = acpi_find_table(ACPI_SIG_MADT);<br class=3D""><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (physaddr =3D=3D 0)<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>return;<br class=3D"">@@ -405,6 = +423,20 @@ gic_v3_acpi_bus_attach(device_t dev)<br class=3D""><br = class=3D""><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>acpi_walk_subtables(madt + 1, (char *)madt + = madt->Header.Length,<br class=3D""><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span> gic_v3_add_= children, dev);<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>/* Add the vgic child if needed = */<br class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: = pre;"> </span>if (((uintptr_t)acpi_get_private(dev) & = GICV3_PRIV_FLAGS) !=3D 0) {<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>child =3D device_add_child(dev, = "vgic", -1);<br class=3D""></blockquote><br style=3D"caret-color: rgb(0, = 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">Do we have anything to attach to this, or is this just = creating</span><br style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: 400; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: 400; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none; float: none; display: inline !important;" class=3D"">children that = will never do anything?</span><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: 400; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""></div></blockquote><div><br = class=3D""></div><div>This will be used by Bhyve to attach a virtual gic = driver so we can use standard methods to handle interacting with the = hardware.</div><div><br class=3D""></div><div>Andrew</div></div><br = class=3D""></body></html>= --Apple-Mail=_D48D8010-9C1C-4854-8E75-50154E0EED7B--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BD5DB3A1-10A4-4144-985A-0C434F501D69>