qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cmd646: remove pci_cmd646_ide_init() function
@ 2020-02-14  8:46 Mark Cave-Ayland
  2020-02-14  8:46 ` [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device Mark Cave-Ayland
  2020-02-14  8:46 ` [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function Mark Cave-Ayland
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Cave-Ayland @ 2020-02-14  8:46 UTC (permalink / raw)
  To: qemu-devel, rth, jsnow

The recent cmd646 discussions reminded me of this patch I've had sitting in an
old branch for a while.

The DP264 machine is the last remaining user of the deprecated
pci_cmd646_ide_init() init function. Switch it over to using qdev via pci_create()
and then remove the now-unused pci_cmd646_ide_init() function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>

Mark Cave-Ayland (2):
  dp264: use pci_create() to initialise the cmd646 device
  cmd646: remove unused pci_cmd646_ide_init() function

 hw/alpha/dp264.c |  8 +++++++-
 hw/ide/cmd646.c  | 12 ------------
 include/hw/ide.h |  2 --
 3 files changed, 7 insertions(+), 15 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device
  2020-02-14  8:46 [PATCH 0/2] cmd646: remove pci_cmd646_ide_init() function Mark Cave-Ayland
@ 2020-02-14  8:46 ` Mark Cave-Ayland
  2020-02-14 11:47   ` Philippe Mathieu-Daudé
  2020-02-16  9:31   ` Richard Henderson
  2020-02-14  8:46 ` [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function Mark Cave-Ayland
  1 sibling, 2 replies; 7+ messages in thread
From: Mark Cave-Ayland @ 2020-02-14  8:46 UTC (permalink / raw)
  To: qemu-devel, rth, jsnow

Remove the call to pci_cmd646_ide_init() since global device init functions
are deprecated in preference of using qdev directly.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/alpha/dp264.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
index a8f9a89cc4..e91989bf9a 100644
--- a/hw/alpha/dp264.c
+++ b/hw/alpha/dp264.c
@@ -16,6 +16,7 @@
 #include "sysemu/sysemu.h"
 #include "hw/rtc/mc146818rtc.h"
 #include "hw/ide.h"
+#include "hw/ide/pci.h"
 #include "hw/timer/i8254.h"
 #include "hw/isa/superio.h"
 #include "hw/dma/i8257.h"
@@ -100,9 +101,14 @@ static void clipper_init(MachineState *machine)
     /* IDE disk setup.  */
     {
         DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
+        PCIDevice *pci_dev;
+
         ide_drive_get(hd, ARRAY_SIZE(hd));
 
-        pci_cmd646_ide_init(pci_bus, hd, 0);
+        pci_dev = pci_create(pci_bus, -1, "cmd646-ide");
+        qdev_prop_set_uint32(DEVICE(pci_dev), "secondary", 0);
+        qdev_init_nofail(DEVICE(pci_dev));
+        pci_ide_create_devs(pci_dev, hd);
     }
 
     /* Load PALcode.  Given that this is not "real" cpu palcode,
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function
  2020-02-14  8:46 [PATCH 0/2] cmd646: remove pci_cmd646_ide_init() function Mark Cave-Ayland
  2020-02-14  8:46 ` [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device Mark Cave-Ayland
@ 2020-02-14  8:46 ` Mark Cave-Ayland
  2020-02-16  9:31   ` Richard Henderson
  1 sibling, 1 reply; 7+ messages in thread
From: Mark Cave-Ayland @ 2020-02-14  8:46 UTC (permalink / raw)
  To: qemu-devel, rth, jsnow

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 hw/ide/cmd646.c  | 12 ------------
 include/hw/ide.h |  2 --
 2 files changed, 14 deletions(-)

diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index 335c060673..d953932104 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -317,18 +317,6 @@ static void pci_cmd646_ide_exitfn(PCIDevice *dev)
     }
 }
 
-void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
-                         int secondary_ide_enabled)
-{
-    PCIDevice *dev;
-
-    dev = pci_create(bus, -1, "cmd646-ide");
-    qdev_prop_set_uint32(&dev->qdev, "secondary", secondary_ide_enabled);
-    qdev_init_nofail(&dev->qdev);
-
-    pci_ide_create_devs(dev, hd_table);
-}
-
 static Property cmd646_ide_properties[] = {
     DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/include/hw/ide.h b/include/hw/ide.h
index 28d8a06439..0c7080ed92 100644
--- a/include/hw/ide.h
+++ b/include/hw/ide.h
@@ -12,8 +12,6 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
                         DriveInfo *hd0, DriveInfo *hd1);
 
 /* ide-pci.c */
-void pci_cmd646_ide_init(PCIBus *bus, DriveInfo **hd_table,
-                         int secondary_ide_enabled);
 PCIDevice *pci_piix3_xen_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn);
 PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn);
 PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn);
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device
  2020-02-14  8:46 ` [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device Mark Cave-Ayland
@ 2020-02-14 11:47   ` Philippe Mathieu-Daudé
  2020-02-14 19:16     ` Mark Cave-Ayland
  2020-02-16  9:31   ` Richard Henderson
  1 sibling, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-14 11:47 UTC (permalink / raw)
  To: Mark Cave-Ayland; +Cc: John Snow, QEMU Developers, Richard Henderson

Hi Mark,

On Fri, Feb 14, 2020 at 9:48 AM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> Remove the call to pci_cmd646_ide_init() since global device init functions
> are deprecated in preference of using qdev directly.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/alpha/dp264.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
> index a8f9a89cc4..e91989bf9a 100644
> --- a/hw/alpha/dp264.c
> +++ b/hw/alpha/dp264.c
> @@ -16,6 +16,7 @@
>  #include "sysemu/sysemu.h"
>  #include "hw/rtc/mc146818rtc.h"
>  #include "hw/ide.h"
> +#include "hw/ide/pci.h"
>  #include "hw/timer/i8254.h"
>  #include "hw/isa/superio.h"
>  #include "hw/dma/i8257.h"
> @@ -100,9 +101,14 @@ static void clipper_init(MachineState *machine)
>      /* IDE disk setup.  */
>      {
>          DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> +        PCIDevice *pci_dev;
> +
>          ide_drive_get(hd, ARRAY_SIZE(hd));
>
> -        pci_cmd646_ide_init(pci_bus, hd, 0);
> +        pci_dev = pci_create(pci_bus, -1, "cmd646-ide");

Not this patch problem, but it would be nice to have a TYPE_CMD646_IDE.

> +        qdev_prop_set_uint32(DEVICE(pci_dev), "secondary", 0);

Secondary_ide disabled is the default in cmd646_ide_properties[], can
we avoid this call?

> +        qdev_init_nofail(DEVICE(pci_dev));
> +        pci_ide_create_devs(pci_dev, hd);
>      }
>
>      /* Load PALcode.  Given that this is not "real" cpu palcode,
> --
> 2.20.1
>
>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device
  2020-02-14 11:47   ` Philippe Mathieu-Daudé
@ 2020-02-14 19:16     ` Mark Cave-Ayland
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Cave-Ayland @ 2020-02-14 19:16 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: John Snow, QEMU Developers, Richard Henderson

On 14/02/2020 11:47, Philippe Mathieu-Daudé wrote:

> Hi Mark,
> 
> On Fri, Feb 14, 2020 at 9:48 AM Mark Cave-Ayland
> <mark.cave-ayland@ilande.co.uk> wrote:
>>
>> Remove the call to pci_cmd646_ide_init() since global device init functions
>> are deprecated in preference of using qdev directly.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>  hw/alpha/dp264.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/hw/alpha/dp264.c b/hw/alpha/dp264.c
>> index a8f9a89cc4..e91989bf9a 100644
>> --- a/hw/alpha/dp264.c
>> +++ b/hw/alpha/dp264.c
>> @@ -16,6 +16,7 @@
>>  #include "sysemu/sysemu.h"
>>  #include "hw/rtc/mc146818rtc.h"
>>  #include "hw/ide.h"
>> +#include "hw/ide/pci.h"
>>  #include "hw/timer/i8254.h"
>>  #include "hw/isa/superio.h"
>>  #include "hw/dma/i8257.h"
>> @@ -100,9 +101,14 @@ static void clipper_init(MachineState *machine)
>>      /* IDE disk setup.  */
>>      {
>>          DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
>> +        PCIDevice *pci_dev;
>> +
>>          ide_drive_get(hd, ARRAY_SIZE(hd));
>>
>> -        pci_cmd646_ide_init(pci_bus, hd, 0);
>> +        pci_dev = pci_create(pci_bus, -1, "cmd646-ide");
> 
> Not this patch problem, but it would be nice to have a TYPE_CMD646_IDE.

Yeah - there are quite a few places where this could be improved, but certainly a
patch for another day.

>> +        qdev_prop_set_uint32(DEVICE(pci_dev), "secondary", 0);
> 
> Secondary_ide disabled is the default in cmd646_ide_properties[], can
> we avoid this call?

Sure. The patch in its current form is a very simple like-for-like conversion, but it
can be easily be removed.

If we're going to do this then another thing to consider is if we want to replace the
-1 in pci_create() with a specific PCI_DEVFN value to make things a bit more robust.


ATB,

Mark.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device
  2020-02-14  8:46 ` [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device Mark Cave-Ayland
  2020-02-14 11:47   ` Philippe Mathieu-Daudé
@ 2020-02-16  9:31   ` Richard Henderson
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2020-02-16  9:31 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel, rth, jsnow

On 2/14/20 12:46 AM, Mark Cave-Ayland wrote:
> Remove the call to pci_cmd646_ide_init() since global device init functions
> are deprecated in preference of using qdev directly.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/alpha/dp264.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function
  2020-02-14  8:46 ` [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function Mark Cave-Ayland
@ 2020-02-16  9:31   ` Richard Henderson
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2020-02-16  9:31 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel, rth, jsnow

On 2/14/20 12:46 AM, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  hw/ide/cmd646.c  | 12 ------------
>  include/hw/ide.h |  2 --
>  2 files changed, 14 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-16  9:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14  8:46 [PATCH 0/2] cmd646: remove pci_cmd646_ide_init() function Mark Cave-Ayland
2020-02-14  8:46 ` [PATCH 1/2] dp264: use pci_create() to initialise the cmd646 device Mark Cave-Ayland
2020-02-14 11:47   ` Philippe Mathieu-Daudé
2020-02-14 19:16     ` Mark Cave-Ayland
2020-02-16  9:31   ` Richard Henderson
2020-02-14  8:46 ` [PATCH 2/2] cmd646: remove unused pci_cmd646_ide_init() function Mark Cave-Ayland
2020-02-16  9:31   ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).