diff mbox

virtio_mmio: add ACPI probing

Message ID 1438076642-12080-1-git-send-email-graeme.gregory@linaro.org
State Accepted
Commit 38c4ab8e48ab153dee461e10e81256720b70a0b3
Headers show

Commit Message

Graeme Gregory July 28, 2015, 9:44 a.m. UTC
Added the match table and pointers for ACPI probing to the driver.

This uses the same identifier for virt devices as being used for qemu
ARM64 ACPI support.

http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e

Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
---
 drivers/virtio/virtio_mmio.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Peter Maydell July 28, 2015, 10:12 a.m. UTC | #1
On 28 July 2015 at 11:08, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Tue, Jul 28, 2015 at 10:44:02AM +0100, Graeme Gregory wrote:
>> Added the match table and pointers for ACPI probing to the driver.
>>
>> This uses the same identifier for virt devices as being used for qemu
>> ARM64 ACPI support.
>>
>> http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e
>>
>> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
>> ---
>>  drivers/virtio/virtio_mmio.c | 10 ++++++++++
>>  1 file changed, 10 insertions(+)
>>
>> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
>> index 10189b5..f499d9d 100644
>> --- a/drivers/virtio/virtio_mmio.c
>> +++ b/drivers/virtio/virtio_mmio.c
>> @@ -58,6 +58,7 @@
>>
>>  #define pr_fmt(fmt) "virtio-mmio: " fmt
>>
>> +#include <linux/acpi.h>
>>  #include <linux/highmem.h>
>>  #include <linux/interrupt.h>
>>  #include <linux/io.h>
>> @@ -732,12 +733,21 @@ static struct of_device_id virtio_mmio_match[] = {
>>  };
>>  MODULE_DEVICE_TABLE(of, virtio_mmio_match);
>>
>> +#ifdef CONFIG_ACPI
>> +static const struct acpi_device_id virtio_mmio_acpi_match[] = {
>> +     { "LNRO0005", },
>> +     { }
>> +};
>
> Hmm - we have reserved QEMUXXXX in ASWG explicitly for this purpose.
>
> Pater - do you think it's a good idea to change this before QEMU 2.4
> is released?

Shannon's call, I guess. I don't know enough about ACPI to say.
I thought these ACPI IDs were already fixed because they were
what the kernel was looking for...

-- PMM
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Graeme Gregory July 28, 2015, 10:33 a.m. UTC | #2
On 28 July 2015 at 11:27, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Tue, Jul 28, 2015 at 11:12:33AM +0100, Peter Maydell wrote:
>> On 28 July 2015 at 11:08, Michael S. Tsirkin <mst@redhat.com> wrote:
>> > On Tue, Jul 28, 2015 at 10:44:02AM +0100, Graeme Gregory wrote:
>> >> Added the match table and pointers for ACPI probing to the driver.
>> >>
>> >> This uses the same identifier for virt devices as being used for qemu
>> >> ARM64 ACPI support.
>> >>
>> >> http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e
>> >>
>> >> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
>> >> ---
>> >>  drivers/virtio/virtio_mmio.c | 10 ++++++++++
>> >>  1 file changed, 10 insertions(+)
>> >>
>> >> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
>> >> index 10189b5..f499d9d 100644
>> >> --- a/drivers/virtio/virtio_mmio.c
>> >> +++ b/drivers/virtio/virtio_mmio.c
>> >> @@ -58,6 +58,7 @@
>> >>
>> >>  #define pr_fmt(fmt) "virtio-mmio: " fmt
>> >>
>> >> +#include <linux/acpi.h>
>> >>  #include <linux/highmem.h>
>> >>  #include <linux/interrupt.h>
>> >>  #include <linux/io.h>
>> >> @@ -732,12 +733,21 @@ static struct of_device_id virtio_mmio_match[] = {
>> >>  };
>> >>  MODULE_DEVICE_TABLE(of, virtio_mmio_match);
>> >>
>> >> +#ifdef CONFIG_ACPI
>> >> +static const struct acpi_device_id virtio_mmio_acpi_match[] = {
>> >> +     { "LNRO0005", },
>> >> +     { }
>> >> +};
>> >
>> > Hmm - we have reserved QEMUXXXX in ASWG explicitly for this purpose.
>> >
>> > Pater - do you think it's a good idea to change this before QEMU 2.4
>> > is released?
>>
>> Shannon's call, I guess. I don't know enough about ACPI to say.
>> I thought these ACPI IDs were already fixed because they were
>> what the kernel was looking for...
>>
>> -- PMM
>
> Apparently not :)
>
We assigned LNRO in ASWG to avoid collisions with our prototypes/real
platforms so it makes sense to me to switch to QEMUXXXX.

I will submit a new patch if Shannon wants to switch to that form.

Graeme
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Peter Maydell July 28, 2015, 8:12 p.m. UTC | #3
On 28 July 2015 at 11:27, Michael S. Tsirkin <mst@redhat.com> wrote:
> On Tue, Jul 28, 2015 at 11:12:33AM +0100, Peter Maydell wrote:
>> On 28 July 2015 at 11:08, Michael S. Tsirkin <mst@redhat.com> wrote:
>> > On Tue, Jul 28, 2015 at 10:44:02AM +0100, Graeme Gregory wrote:
>> >> Added the match table and pointers for ACPI probing to the driver.
>> >>
>> >> This uses the same identifier for virt devices as being used for qemu
>> >> ARM64 ACPI support.
>> >>
>> >> http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e
>> >>
>> >> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>

>> >> +#ifdef CONFIG_ACPI
>> >> +static const struct acpi_device_id virtio_mmio_acpi_match[] = {
>> >> +     { "LNRO0005", },
>> >> +     { }
>> >> +};
>> >
>> > Hmm - we have reserved QEMUXXXX in ASWG explicitly for this purpose.
>> >
>> > Pater - do you think it's a good idea to change this before QEMU 2.4
>> > is released?
>>
>> Shannon's call, I guess. I don't know enough about ACPI to say.
>> I thought these ACPI IDs were already fixed because they were
>> what the kernel was looking for...

> Apparently not :)

Mmm. I'm not terribly happy about stuff being in QEMU before the
ACPI spec for it has been finalised. We should not be picking
stuff randomly on the fly...

If we want to fix the ACPI IDs QEMU is using for 2.4 then we
really need to do that now (ie within the next day or two).

-- PMM
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Graeme Gregory July 28, 2015, 8:28 p.m. UTC | #4
On 28 July 2015 at 21:12, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 28 July 2015 at 11:27, Michael S. Tsirkin <mst@redhat.com> wrote:
>> On Tue, Jul 28, 2015 at 11:12:33AM +0100, Peter Maydell wrote:
>>> On 28 July 2015 at 11:08, Michael S. Tsirkin <mst@redhat.com> wrote:
>>> > On Tue, Jul 28, 2015 at 10:44:02AM +0100, Graeme Gregory wrote:
>>> >> Added the match table and pointers for ACPI probing to the driver.
>>> >>
>>> >> This uses the same identifier for virt devices as being used for qemu
>>> >> ARM64 ACPI support.
>>> >>
>>> >> http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e
>>> >>
>>> >> Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
>
>>> >> +#ifdef CONFIG_ACPI
>>> >> +static const struct acpi_device_id virtio_mmio_acpi_match[] = {
>>> >> +     { "LNRO0005", },
>>> >> +     { }
>>> >> +};
>>> >
>>> > Hmm - we have reserved QEMUXXXX in ASWG explicitly for this purpose.
>>> >
>>> > Pater - do you think it's a good idea to change this before QEMU 2.4
>>> > is released?
>>>
>>> Shannon's call, I guess. I don't know enough about ACPI to say.
>>> I thought these ACPI IDs were already fixed because they were
>>> what the kernel was looking for...
>
>> Apparently not :)
>
> Mmm. I'm not terribly happy about stuff being in QEMU before the
> ACPI spec for it has been finalised. We should not be picking
> stuff randomly on the fly...
>
> If we want to fix the ACPI IDs QEMU is using for 2.4 then we
> really need to do that now (ie within the next day or two).
>
It is upto the owner of the QEMU prefix to allocate numbers. This is
not an issue for ACPI spec at all.

Graeme
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Peter Maydell July 28, 2015, 9:10 p.m. UTC | #5
On 28 July 2015 at 21:28, G Gregory <graeme.gregory@linaro.org> wrote:
> On 28 July 2015 at 21:12, Peter Maydell <peter.maydell@linaro.org> wrote:
>> Mmm. I'm not terribly happy about stuff being in QEMU before the
>> ACPI spec for it has been finalised. We should not be picking
>> stuff randomly on the fly...
>>
>> If we want to fix the ACPI IDs QEMU is using for 2.4 then we
>> really need to do that now (ie within the next day or two).
>>
> It is upto the owner of the QEMU prefix to allocate numbers. This is
> not an issue for ACPI spec at all.

I mean "the specification for how this device should be advertised
in an ACPI table". I don't care whether that's an official ACPI
consortium thing or something less official. The table is
constructed by QEMU and read by the kernel (and possibly
also by UEFI?), so everybody needs to agree on what the
string is...

thanks
-- PMM
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Shannon Zhao July 29, 2015, 2:01 a.m. UTC | #6
On 2015/7/29 5:10, Peter Maydell wrote:
> On 28 July 2015 at 21:28, G Gregory <graeme.gregory@linaro.org> wrote:
>> > On 28 July 2015 at 21:12, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> >> Mmm. I'm not terribly happy about stuff being in QEMU before the
>>> >> ACPI spec for it has been finalised. We should not be picking
>>> >> stuff randomly on the fly...
>>> >>
>>> >> If we want to fix the ACPI IDs QEMU is using for 2.4 then we
>>> >> really need to do that now (ie within the next day or two).
>>> >>
>> > It is upto the owner of the QEMU prefix to allocate numbers. This is
>> > not an issue for ACPI spec at all.
> I mean "the specification for how this device should be advertised
> in an ACPI table". I don't care whether that's an official ACPI
> consortium thing or something less official. The table is
> constructed by QEMU and read by the kernel (and possibly
> also by UEFI?), so everybody needs to agree on what the
> string is...

I agree with Peter. Maybe we should record these IDs at some place.
Since QEMU is owner of this device and we register QEMU in ASWG, the
official ID can be assigned by QEMU and the ID could(or should) be
"QEMUXXXX". But what's the exact ID for this virtio-mmio? That's what we
need to agree on and record.

P.S. I don't see "QEMU" in the list of approved Vendor IDs for ACPI.
http://www.uefi.org/sites/default/files/resources/PNPID_List.pdf
http://www.uefi.org/sites/default/files/resources/ACPIID_List.pdf
Peter Maydell July 29, 2015, 5:52 p.m. UTC | #7
On 28 July 2015 at 11:33, G Gregory <graeme.gregory@linaro.org> wrote:
> We assigned LNRO in ASWG to avoid collisions with our prototypes/real
> platforms so it makes sense to me to switch to QEMUXXXX.

So just to check, if we switch virtio-mmio from an LNRO0005 ID
to a QEMUxxxx ID we aren't going to break any existing widely
shipped or deployed code, right?

If we can change the ID without breaking anything significant
then I think the QEMU ID makes more sense; but it doesn't
really gain us much beyond tidiness.

PS: https://www.kernel.org/doc/Documentation/arm64/arm-acpi.txt
uses virtio-mmio and LNRO0005 as its code example, so if
we change this then it might be nice to update the docs
as a followup.

thanks
-- PMM
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Graeme Gregory Aug. 27, 2015, 2:55 p.m. UTC | #8
On Wed, Jul 29, 2015 at 09:17:08PM +0300, Michael S. Tsirkin wrote:
> On Tue, Jul 28, 2015 at 10:44:02AM +0100, Graeme Gregory wrote:
> > Added the match table and pointers for ACPI probing to the driver.
> > 
> > This uses the same identifier for virt devices as being used for qemu
> > ARM64 ACPI support.
> > 
> > http://git.linaro.org/people/shannon.zhao/qemu.git/commit/d0bf1955a3ecbab4b51d46f8c5dda02b7e14a17e
> > 
> > Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
> 
> To summarize, let's wait a bit with this until QEMU 2.4
> with the relevant code is out, to make sure ID does not
> change.
> 

It seems qemu 2.4 released with the LNRO0005 identifier.

Graeme

> > ---
> >  drivers/virtio/virtio_mmio.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > index 10189b5..f499d9d 100644
> > --- a/drivers/virtio/virtio_mmio.c
> > +++ b/drivers/virtio/virtio_mmio.c
> > @@ -58,6 +58,7 @@
> >  
> >  #define pr_fmt(fmt) "virtio-mmio: " fmt
> >  
> > +#include <linux/acpi.h>
> >  #include <linux/highmem.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/io.h>
> > @@ -732,12 +733,21 @@ static struct of_device_id virtio_mmio_match[] = {
> >  };
> >  MODULE_DEVICE_TABLE(of, virtio_mmio_match);
> >  
> > +#ifdef CONFIG_ACPI
> > +static const struct acpi_device_id virtio_mmio_acpi_match[] = {
> > +	{ "LNRO0005", },
> > +	{ }
> > +};
> > +MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
> > +#endif
> > +
> >  static struct platform_driver virtio_mmio_driver = {
> >  	.probe		= virtio_mmio_probe,
> >  	.remove		= virtio_mmio_remove,
> >  	.driver		= {
> >  		.name	= "virtio-mmio",
> >  		.of_match_table	= virtio_mmio_match,
> > +		.acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
> >  	},
> >  };
> >  
> > -- 
> > 2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 10189b5..f499d9d 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -58,6 +58,7 @@ 
 
 #define pr_fmt(fmt) "virtio-mmio: " fmt
 
+#include <linux/acpi.h>
 #include <linux/highmem.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
@@ -732,12 +733,21 @@  static struct of_device_id virtio_mmio_match[] = {
 };
 MODULE_DEVICE_TABLE(of, virtio_mmio_match);
 
+#ifdef CONFIG_ACPI
+static const struct acpi_device_id virtio_mmio_acpi_match[] = {
+	{ "LNRO0005", },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, virtio_mmio_acpi_match);
+#endif
+
 static struct platform_driver virtio_mmio_driver = {
 	.probe		= virtio_mmio_probe,
 	.remove		= virtio_mmio_remove,
 	.driver		= {
 		.name	= "virtio-mmio",
 		.of_match_table	= virtio_mmio_match,
+		.acpi_match_table = ACPI_PTR(virtio_mmio_acpi_match),
 	},
 };