* [PATCH] hw/pci-host: Use register definitions from PCI standard
@ 2023-01-05 14:41 Philippe Mathieu-Daudé
2023-01-05 16:02 ` BALATON Zoltan
2023-01-07 23:58 ` Mark Cave-Ayland
0 siblings, 2 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-05 14:41 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, Mark Cave-Ayland, Michael S. Tsirkin,
Hervé Poussineau, Marcel Apfelbaum,
Philippe Mathieu-Daudé
No need to document magic values when the definition names
from "standard-headers/linux/pci_regs.h" are self-explicit.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/pci-host/grackle.c | 2 +-
hw/pci-host/raven.c | 6 +++---
hw/pci-host/uninorth.c | 30 +++++++++++-------------------
3 files changed, 15 insertions(+), 23 deletions(-)
diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
index 95945ac0f4..2a45cc13c3 100644
--- a/hw/pci-host/grackle.c
+++ b/hw/pci-host/grackle.c
@@ -91,7 +91,7 @@ static void grackle_init(Object *obj)
static void grackle_pci_realize(PCIDevice *d, Error **errp)
{
- d->config[0x09] = 0x01;
+ d->config[PCI_CLASS_PROG] = 0x01;
}
static void grackle_pci_class_init(ObjectClass *klass, void *data)
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 7a105e4a63..c47259a851 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -329,9 +329,9 @@ static void raven_realize(PCIDevice *d, Error **errp)
char *filename;
int bios_size = -1;
- d->config[0x0C] = 0x08; // cache_line_size
- d->config[0x0D] = 0x10; // latency_timer
- d->config[0x34] = 0x00; // capabilities_pointer
+ d->config[PCI_CACHE_LINE_SIZE] = 0x08;
+ d->config[PCI_LATENCY_TIMER] = 0x10;
+ d->config[PCI_CAPABILITY_LIST] = 0x00;
memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
&error_fatal);
diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
index 8396c91d59..342baff12a 100644
--- a/hw/pci-host/uninorth.c
+++ b/hw/pci-host/uninorth.c
@@ -277,11 +277,11 @@ static void pci_unin_internal_init(Object *obj)
static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
{
/* cache_line_size */
- d->config[0x0C] = 0x08;
+ d->config[PCI_CACHE_LINE_SIZE] = 0x08;
/* latency_timer */
- d->config[0x0D] = 0x10;
+ d->config[PCI_LATENCY_TIMER] = 0x10;
/* capabilities_pointer */
- d->config[0x34] = 0x00;
+ d->config[PCI_CAPABILITY_LIST] = 0x00;
/*
* Set kMacRISCPCIAddressSelect (0x48) register to indicate PCI
@@ -296,30 +296,22 @@ static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
static void unin_agp_pci_host_realize(PCIDevice *d, Error **errp)
{
- /* cache_line_size */
- d->config[0x0C] = 0x08;
- /* latency_timer */
- d->config[0x0D] = 0x10;
- /* capabilities_pointer
- d->config[0x34] = 0x80; */
+ d->config[PCI_CACHE_LINE_SIZE] = 0x08;
+ d->config[PCI_LATENCY_TIMER] = 0x10;
+ /* d->config[PCI_CAPABILITY_LIST] = 0x80; */
}
static void u3_agp_pci_host_realize(PCIDevice *d, Error **errp)
{
- /* cache line size */
- d->config[0x0C] = 0x08;
- /* latency timer */
- d->config[0x0D] = 0x10;
+ d->config[PCI_CACHE_LINE_SIZE] = 0x08;
+ d->config[PCI_LATENCY_TIMER] = 0x10;
}
static void unin_internal_pci_host_realize(PCIDevice *d, Error **errp)
{
- /* cache_line_size */
- d->config[0x0C] = 0x08;
- /* latency_timer */
- d->config[0x0D] = 0x10;
- /* capabilities_pointer */
- d->config[0x34] = 0x00;
+ d->config[PCI_CACHE_LINE_SIZE] = 0x08;
+ d->config[PCI_LATENCY_TIMER] = 0x10;
+ d->config[PCI_CAPABILITY_LIST] = 0x00;
}
static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
--
2.38.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/pci-host: Use register definitions from PCI standard
2023-01-05 14:41 [PATCH] hw/pci-host: Use register definitions from PCI standard Philippe Mathieu-Daudé
@ 2023-01-05 16:02 ` BALATON Zoltan
2023-01-05 16:34 ` Philippe Mathieu-Daudé
2023-01-05 16:37 ` Bernhard Beschow
2023-01-07 23:58 ` Mark Cave-Ayland
1 sibling, 2 replies; 5+ messages in thread
From: BALATON Zoltan @ 2023-01-05 16:02 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, qemu-ppc, Mark Cave-Ayland, Michael S. Tsirkin,
Hervé Poussineau, Marcel Apfelbaum
[-- Attachment #1: Type: text/plain, Size: 3601 bytes --]
On Thu, 5 Jan 2023, Philippe Mathieu-Daudé wrote:
> No need to document magic values when the definition names
> from "standard-headers/linux/pci_regs.h" are self-explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/pci-host/grackle.c | 2 +-
> hw/pci-host/raven.c | 6 +++---
> hw/pci-host/uninorth.c | 30 +++++++++++-------------------
> 3 files changed, 15 insertions(+), 23 deletions(-)
>
> diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
> index 95945ac0f4..2a45cc13c3 100644
> --- a/hw/pci-host/grackle.c
> +++ b/hw/pci-host/grackle.c
> @@ -91,7 +91,7 @@ static void grackle_init(Object *obj)
>
> static void grackle_pci_realize(PCIDevice *d, Error **errp)
> {
> - d->config[0x09] = 0x01;
> + d->config[PCI_CLASS_PROG] = 0x01;
> }
>
> static void grackle_pci_class_init(ObjectClass *klass, void *data)
> diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
> index 7a105e4a63..c47259a851 100644
> --- a/hw/pci-host/raven.c
> +++ b/hw/pci-host/raven.c
> @@ -329,9 +329,9 @@ static void raven_realize(PCIDevice *d, Error **errp)
> char *filename;
> int bios_size = -1;
>
> - d->config[0x0C] = 0x08; // cache_line_size
> - d->config[0x0D] = 0x10; // latency_timer
> - d->config[0x34] = 0x00; // capabilities_pointer
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>
> memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
> &error_fatal);
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index 8396c91d59..342baff12a 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -277,11 +277,11 @@ static void pci_unin_internal_init(Object *obj)
> static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
> {
> /* cache_line_size */
> - d->config[0x0C] = 0x08;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> /* latency_timer */
> - d->config[0x0D] = 0x10;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> /* capabilities_pointer */
> - d->config[0x34] = 0x00;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
Did you mean to remove the comments here as well?
Regards,
BALATON Zoltan
> /*
> * Set kMacRISCPCIAddressSelect (0x48) register to indicate PCI
> @@ -296,30 +296,22 @@ static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
>
> static void unin_agp_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache_line_size */
> - d->config[0x0C] = 0x08;
> - /* latency_timer */
> - d->config[0x0D] = 0x10;
> - /* capabilities_pointer
> - d->config[0x34] = 0x80; */
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + /* d->config[PCI_CAPABILITY_LIST] = 0x80; */
> }
>
> static void u3_agp_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache line size */
> - d->config[0x0C] = 0x08;
> - /* latency timer */
> - d->config[0x0D] = 0x10;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> }
>
> static void unin_internal_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache_line_size */
> - d->config[0x0C] = 0x08;
> - /* latency_timer */
> - d->config[0x0D] = 0x10;
> - /* capabilities_pointer */
> - d->config[0x34] = 0x00;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
> }
>
> static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/pci-host: Use register definitions from PCI standard
2023-01-05 16:02 ` BALATON Zoltan
@ 2023-01-05 16:34 ` Philippe Mathieu-Daudé
2023-01-05 16:37 ` Bernhard Beschow
1 sibling, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-01-05 16:34 UTC (permalink / raw)
To: BALATON Zoltan
Cc: qemu-devel, qemu-ppc, Mark Cave-Ayland, Michael S. Tsirkin,
Hervé Poussineau, Marcel Apfelbaum
On 5/1/23 17:02, BALATON Zoltan wrote:
> On Thu, 5 Jan 2023, Philippe Mathieu-Daudé wrote:
>> No need to document magic values when the definition names
>> from "standard-headers/linux/pci_regs.h" are self-explicit.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/pci-host/grackle.c | 2 +-
>> hw/pci-host/raven.c | 6 +++---
>> hw/pci-host/uninorth.c | 30 +++++++++++-------------------
>> 3 files changed, 15 insertions(+), 23 deletions(-)
>> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
>> index 8396c91d59..342baff12a 100644
>> --- a/hw/pci-host/uninorth.c
>> +++ b/hw/pci-host/uninorth.c
>> @@ -277,11 +277,11 @@ static void pci_unin_internal_init(Object *obj)
>> static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
>> {
>> /* cache_line_size */
>> - d->config[0x0C] = 0x08;
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> /* latency_timer */
>> - d->config[0x0D] = 0x10;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> /* capabilities_pointer */
>> - d->config[0x34] = 0x00;
>> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>
> Did you mean to remove the comments here as well?
Good point, thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/pci-host: Use register definitions from PCI standard
2023-01-05 16:02 ` BALATON Zoltan
2023-01-05 16:34 ` Philippe Mathieu-Daudé
@ 2023-01-05 16:37 ` Bernhard Beschow
1 sibling, 0 replies; 5+ messages in thread
From: Bernhard Beschow @ 2023-01-05 16:37 UTC (permalink / raw)
To: qemu-devel, BALATON Zoltan, Philippe Mathieu-Daudé
Cc: qemu-ppc, Mark Cave-Ayland, Michael S. Tsirkin,
Hervé Poussineau, Marcel Apfelbaum
Am 5. Januar 2023 16:02:48 UTC schrieb BALATON Zoltan <balaton@eik.bme.hu>:
>On Thu, 5 Jan 2023, Philippe Mathieu-Daudé wrote:
>> No need to document magic values when the definition names
>> from "standard-headers/linux/pci_regs.h" are self-explicit.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>> hw/pci-host/grackle.c | 2 +-
>> hw/pci-host/raven.c | 6 +++---
>> hw/pci-host/uninorth.c | 30 +++++++++++-------------------
>> 3 files changed, 15 insertions(+), 23 deletions(-)
>>
>> diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
>> index 95945ac0f4..2a45cc13c3 100644
>> --- a/hw/pci-host/grackle.c
>> +++ b/hw/pci-host/grackle.c
>> @@ -91,7 +91,7 @@ static void grackle_init(Object *obj)
>>
>> static void grackle_pci_realize(PCIDevice *d, Error **errp)
>> {
>> - d->config[0x09] = 0x01;
>> + d->config[PCI_CLASS_PROG] = 0x01;
>> }
>>
>> static void grackle_pci_class_init(ObjectClass *klass, void *data)
>> diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
>> index 7a105e4a63..c47259a851 100644
>> --- a/hw/pci-host/raven.c
>> +++ b/hw/pci-host/raven.c
>> @@ -329,9 +329,9 @@ static void raven_realize(PCIDevice *d, Error **errp)
>> char *filename;
>> int bios_size = -1;
>>
>> - d->config[0x0C] = 0x08; // cache_line_size
>> - d->config[0x0D] = 0x10; // latency_timer
>> - d->config[0x34] = 0x00; // capabilities_pointer
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>>
>> memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
>> &error_fatal);
>> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
>> index 8396c91d59..342baff12a 100644
>> --- a/hw/pci-host/uninorth.c
>> +++ b/hw/pci-host/uninorth.c
>> @@ -277,11 +277,11 @@ static void pci_unin_internal_init(Object *obj)
>> static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
>> {
>> /* cache_line_size */
>> - d->config[0x0C] = 0x08;
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> /* latency_timer */
>> - d->config[0x0D] = 0x10;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> /* capabilities_pointer */
>> - d->config[0x34] = 0x00;
>> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>
>Did you mean to remove the comments here as well?
Removing the comments makes sense to me since they're redundant to the enums.
Best regards,
Bernhard
>
>Regards,
>BALATON Zoltan
>
>> /*
>> * Set kMacRISCPCIAddressSelect (0x48) register to indicate PCI
>> @@ -296,30 +296,22 @@ static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
>>
>> static void unin_agp_pci_host_realize(PCIDevice *d, Error **errp)
>> {
>> - /* cache_line_size */
>> - d->config[0x0C] = 0x08;
>> - /* latency_timer */
>> - d->config[0x0D] = 0x10;
>> - /* capabilities_pointer
>> - d->config[0x34] = 0x80; */
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> + /* d->config[PCI_CAPABILITY_LIST] = 0x80; */
>> }
>>
>> static void u3_agp_pci_host_realize(PCIDevice *d, Error **errp)
>> {
>> - /* cache line size */
>> - d->config[0x0C] = 0x08;
>> - /* latency timer */
>> - d->config[0x0D] = 0x10;
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> }
>>
>> static void unin_internal_pci_host_realize(PCIDevice *d, Error **errp)
>> {
>> - /* cache_line_size */
>> - d->config[0x0C] = 0x08;
>> - /* latency_timer */
>> - d->config[0x0D] = 0x10;
>> - /* capabilities_pointer */
>> - d->config[0x34] = 0x00;
>> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
>> + d->config[PCI_LATENCY_TIMER] = 0x10;
>> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>> }
>>
>> static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] hw/pci-host: Use register definitions from PCI standard
2023-01-05 14:41 [PATCH] hw/pci-host: Use register definitions from PCI standard Philippe Mathieu-Daudé
2023-01-05 16:02 ` BALATON Zoltan
@ 2023-01-07 23:58 ` Mark Cave-Ayland
1 sibling, 0 replies; 5+ messages in thread
From: Mark Cave-Ayland @ 2023-01-07 23:58 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-ppc, Michael S. Tsirkin, Hervé Poussineau, Marcel Apfelbaum
On 05/01/2023 14:41, Philippe Mathieu-Daudé wrote:
> No need to document magic values when the definition names
> from "standard-headers/linux/pci_regs.h" are self-explicit.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/pci-host/grackle.c | 2 +-
> hw/pci-host/raven.c | 6 +++---
> hw/pci-host/uninorth.c | 30 +++++++++++-------------------
> 3 files changed, 15 insertions(+), 23 deletions(-)
>
> diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c
> index 95945ac0f4..2a45cc13c3 100644
> --- a/hw/pci-host/grackle.c
> +++ b/hw/pci-host/grackle.c
> @@ -91,7 +91,7 @@ static void grackle_init(Object *obj)
>
> static void grackle_pci_realize(PCIDevice *d, Error **errp)
> {
> - d->config[0x09] = 0x01;
> + d->config[PCI_CLASS_PROG] = 0x01;
> }
>
> static void grackle_pci_class_init(ObjectClass *klass, void *data)
> diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
> index 7a105e4a63..c47259a851 100644
> --- a/hw/pci-host/raven.c
> +++ b/hw/pci-host/raven.c
> @@ -329,9 +329,9 @@ static void raven_realize(PCIDevice *d, Error **errp)
> char *filename;
> int bios_size = -1;
>
> - d->config[0x0C] = 0x08; // cache_line_size
> - d->config[0x0D] = 0x10; // latency_timer
> - d->config[0x34] = 0x00; // capabilities_pointer
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>
> memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZE,
> &error_fatal);
> diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c
> index 8396c91d59..342baff12a 100644
> --- a/hw/pci-host/uninorth.c
> +++ b/hw/pci-host/uninorth.c
> @@ -277,11 +277,11 @@ static void pci_unin_internal_init(Object *obj)
> static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
> {
> /* cache_line_size */
> - d->config[0x0C] = 0x08;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> /* latency_timer */
> - d->config[0x0D] = 0x10;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> /* capabilities_pointer */
> - d->config[0x34] = 0x00;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
>
> /*
> * Set kMacRISCPCIAddressSelect (0x48) register to indicate PCI
> @@ -296,30 +296,22 @@ static void unin_main_pci_host_realize(PCIDevice *d, Error **errp)
>
> static void unin_agp_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache_line_size */
> - d->config[0x0C] = 0x08;
> - /* latency_timer */
> - d->config[0x0D] = 0x10;
> - /* capabilities_pointer
> - d->config[0x34] = 0x80; */
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + /* d->config[PCI_CAPABILITY_LIST] = 0x80; */
> }
>
> static void u3_agp_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache line size */
> - d->config[0x0C] = 0x08;
> - /* latency timer */
> - d->config[0x0D] = 0x10;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> }
>
> static void unin_internal_pci_host_realize(PCIDevice *d, Error **errp)
> {
> - /* cache_line_size */
> - d->config[0x0C] = 0x08;
> - /* latency_timer */
> - d->config[0x0D] = 0x10;
> - /* capabilities_pointer */
> - d->config[0x34] = 0x00;
> + d->config[PCI_CACHE_LINE_SIZE] = 0x08;
> + d->config[PCI_LATENCY_TIMER] = 0x10;
> + d->config[PCI_CAPABILITY_LIST] = 0x00;
> }
>
> static void unin_main_pci_host_class_init(ObjectClass *klass, void *data)
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
ATB,
Mark.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-07 23:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-05 14:41 [PATCH] hw/pci-host: Use register definitions from PCI standard Philippe Mathieu-Daudé
2023-01-05 16:02 ` BALATON Zoltan
2023-01-05 16:34 ` Philippe Mathieu-Daudé
2023-01-05 16:37 ` Bernhard Beschow
2023-01-07 23:58 ` Mark Cave-Ayland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.