xlnx-zynqmp: Connect the AHCI SATA device
v2 cover xlnx-zynqmp: Connect the AHCI SATA device
This series connects the AHCI SATA device to the ZynqMP machine. It requires a restructure of the AHCI file to make the AHCI state struct visible. It also requires a small change to object_class_dynamic_cast() to return NULL if the class doesn't have a type.
V2:
- Macroify the number of SATA ports
- Update the non-realise error_propagate() calls to use error_abort instead.
Alistair Francis (4):
ahci: Seperate the AHCI state structure into the header object.c: object_class_dynamic_cast return NULL if the class has no
type
xlnx-zynqmp.c: Convert some of the error_propagate() calls to
error_abort
xlnx-zynqmp: Connect the sysbus AHCI to ZynqMP
hw/arm/xlnx-zynqmp.c | 33 +++++++++++++++++++++------------ hw/ide/ahci.c | 13 ------------- hw/ide/ahci.h | 14 ++++++++++++++ include/hw/arm/xlnx-zynqmp.h | 3 +++ qom/object.c | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-)
PATCH v2 1/4 ahci: Separate the AHCI state structure into the header
Pull the AHCI state structure out into the header. This allows other containers to access the struct. This is required to add the device to modern SoC containers.
---
hw/ide/ahci.c | 13 ------------- hw/ide/ahci.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-)
hw/ide/ahci.c +0 -13
@@ -25,7 +25,6 @@#include <hw/pci/msi.h> #include <hw/i386/pc.h> #include <hw/pci/pci.h> -#include <hw/sysbus.h> #include "qemu/error-report.h" #include "sysemu/block-backend.h"
@@ -1625,18 +1624,6 @@ const VMStateDescription vmstate_ahci = { }, }; -#define TYPE_SYSBUS_AHCI "sysbus-ahci" -#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) - -typedef struct SysbusAHCIState { -/*< private >*/ -SysBusDevice parent_obj; -/*< public >*/ - -AHCIState ahci; -uint32_t num_ports; -}SysbusAHCIState ; -static const VMStateDescription vmstate_sysbus_ahci = { .name ="sysbus-ahci" , .fields = (VMStateField []) {
hw/ide/ahci.h +14 -0
@@ -24,6 +24,8 @@#ifndef HW_IDE_AHCI_H #define HW_IDE_AHCI_H +#include <hw/sysbus.h> +#define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32#define AHCI_MAX_SG 168/* hardware max is 64K */
@@ -369,4 +371,16 @@ void ahci_reset(AHCIState *s);void ahci_ide_create_devs (PCIDevice *dev,DriveInfo **hd); +#define TYPE_SYSBUS_AHCI "sysbus-ahci" +#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) + +typedef struct SysbusAHCIState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; +#endif /* HW_IDE_AHCI_H */
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH v2 1/4] ahci: Separate the AHCI state structure into the header
Quoted 65 lines · Alistair Francis
Pull the AHCI state structure out into the header. This allows other containers to access the struct. This is required to add the device to modern SoC containers.
Signed-off-by Alistair Francis <[email protected]>Reviewed-by Sai Pavan Boddu <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>---
hw/ide/ahci.c | 13 ------------- hw/ide/ahci.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-)hw/ide/ahci.c +0
-13@@ -25,7 +25,6 @@#include <hw/pci/msi.h> #include <hw/i386/pc.h> #include <hw/pci/pci.h> -#include <hw/sysbus.h> #include "qemu/error-report.h" #include "sysemu/block-backend.h" @@ -1625,18 +1624,6 @@ const VMStateDescription vmstate_ahci = { }, }; -#define TYPE_SYSBUS_AHCI "sysbus-ahci" -#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) - -typedef struct SysbusAHCIState { -/*< private >*/ -SysBusDevice parent_obj; -/*< public >*/ - -AHCIState ahci; -uint32_t num_ports; -}SysbusAHCIState ; -static const VMStateDescription vmstate_sysbus_ahci = { .name ="sysbus-ahci" , .fields = (VMStateField []) {hw/ide/ahci.h +5
-0@@ -24,6 +24,8 @@#ifndef HW_IDE_AHCI_H #define HW_IDE_AHCI_H +#include <hw/sysbus.h> +#define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32#define AHCI_MAX_SG 168/* hardware max is 64K */ @@ -369,4 +371,16 @@ void ahci_reset(AHCIState *s);void ahci_ide_create_devs (PCIDevice *dev,DriveInfo **hd); +#define TYPE_SYSBUS_AHCI "sysbus-ahci" +#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) +
hw/ide/ahci.h void ahci_reset(AHCIState *s); · line 386
Quoted 10 lines
hw/ide/ahci.h +9
-0+typedef struct SysbusAHCIState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; +#endif /* HW_IDE_AHCI_H */
For whomever eventually merges this; if this indeed the preferred flavor as Peter indicated:
Re: [Qemu-devel] [PATCH v2 1/4] ahci: Separate the AHCI state structure into the header
Quoted 82 lines · John Snow
Quoted 65 lines · Alistair Francis
Pull the AHCI state structure out into the header. This allows other containers to access the struct. This is required to add the device to modern SoC containers.
Signed-off-by Alistair Francis <[email protected]>Reviewed-by Sai Pavan Boddu <[email protected]>Reviewed-by Peter Crosthwaite <[email protected]>---
hw/ide/ahci.c | 13 ------------- hw/ide/ahci.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-)hw/ide/ahci.c +0
-13@@ -25,7 +25,6 @@#include <hw/pci/msi.h> #include <hw/i386/pc.h> #include <hw/pci/pci.h> -#include <hw/sysbus.h> #include "qemu/error-report.h" #include "sysemu/block-backend.h" @@ -1625,18 +1624,6 @@ const VMStateDescription vmstate_ahci = { }, }; -#define TYPE_SYSBUS_AHCI "sysbus-ahci" -#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) - -typedef struct SysbusAHCIState { -/*< private >*/ -SysBusDevice parent_obj; -/*< public >*/ - -AHCIState ahci; -uint32_t num_ports; -}SysbusAHCIState ; -static const VMStateDescription vmstate_sysbus_ahci = { .name ="sysbus-ahci" , .fields = (VMStateField []) {hw/ide/ahci.h +5
-0@@ -24,6 +24,8 @@#ifndef HW_IDE_AHCI_H #define HW_IDE_AHCI_H +#include <hw/sysbus.h> +#define AHCI_MEM_BAR_SIZE 0x1000#define AHCI_MAX_PORTS 32#define AHCI_MAX_SG 168/* hardware max is 64K */ @@ -369,4 +371,16 @@ void ahci_reset(AHCIState *s);void ahci_ide_create_devs (PCIDevice *dev,DriveInfo **hd); +#define TYPE_SYSBUS_AHCI "sysbus-ahci" +#define SYSBUS_AHCI (obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI) +hw/ide/ahci.h void ahci_reset(AHCIState *s); · line 386
Quoted 10 lines
hw/ide/ahci.h +9
-0+typedef struct SysbusAHCIState { +/*< private >*/ +SysBusDevice parent_obj; +/*< public >*/ + +AHCIState ahci; +uint32_t num_ports; +}SysbusAHCIState ; +#endif /* HW_IDE_AHCI_H */ For whomever eventually merges this; if this indeed the preferred flavor as Peter indicated:
Quoted 1 line
Acked-by John Snow <[email protected]>
Thanks :)
Quoted 1 line
PATCH v2 2/4 object.c: object_class_dynamic_cast return NULL if the class has no type
In reply to Alistair FrancisIf the ObjectClass has no type return NULL instead of trying to compare the type name.
---
qom/object.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
qom/object.c +1 -1
@@ -603,7 +603,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,TypeImpl *target_type;TypeImpl *type; -if (!class) { +if (!class || !class->type) {return NULL ; }
Signature · 1 line
1.7.1
PATCH v2 3/4 xlnx-zynqmp.c: Convert some of the error_propagate() calls to error_abort
In reply to Alistair FrancisConvert all of the non-realize error_propagate() calls into error_abort calls as they shouldn't be user visible failure cases.
---
hw/arm/xlnx-zynqmp.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
hw/arm/xlnx-zynqmp.c +2 -12
@@ -147,12 +147,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)g_free (name);object_property_set_int (OBJECT (&s->apu_cpu[i]),GIC_BASE_ADDR , -"reset-cbar" , &err); -if (err) { -error_propagate ((errp), (err)); -return ; - } - +"reset-cbar" , &error_abort);object_property_set_bool (OBJECT (&s->apu_cpu[i]), true,"realized" , &err);if (err) {
@@ -185,12 +180,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)g_free (name);object_property_set_bool (OBJECT (&s->rpu_cpu[i]), true,"reset-hivecs" , - &err); -if (err !=NULL ) { -error_propagate (errp, err); -return ; - } - + &error_abort);object_property_set_bool (OBJECT (&s->rpu_cpu[i]), true,"realized" , &err);if (err) {
Signature · 1 line
1.7.1