@samitouri / QOSamiQemu / commits / eb8f7b37ec

hw/pci-host/aspeed_pcie: convert to use Resettable interface

Replace the legacy reset callback registered via device_class_set_legacy_reset() with the Resettable interface. Signed-off-by: Kane Chen <kane_chen@aspeedtech.com> Reviewed-by: Jamin Lin <jamin_lin@aspeedtech.com> Link: https://lore.kernel.org/qemu-devel/20260525044129.3133916-11-kane_chen@aspeedtech.com Signed-off-by: Cédric Le Goater <clg@redhat.com>

Kane Chen committed May 25, 2026 at 04:41 UTC eb8f7b37ec68ad71851a2f2f46b38936e2b38f0b
1 file changed +12 -9
hw/pci-host/aspeed_pcie.c
+12 -9
@@ -613,9 +613,9 @@ static void aspeed_pcie_cfg_instance_init(Object *obj)
613 return;
614 }
615
616 -static void aspeed_pcie_cfg_reset(DeviceState *dev)
616 +static void aspeed_pcie_cfg_reset_hold(Object *obj, ResetType type)
617 {
618 - AspeedPCIECfgState *s = ASPEED_PCIE_CFG(dev);
618 + AspeedPCIECfgState *s = ASPEED_PCIE_CFG(obj);
619 AspeedPCIECfgClass *apc = ASPEED_PCIE_CFG_GET_CLASS(s);
620
621 memset(s->regs, 0, apc->nr_regs << 2);
@@ -663,12 +663,13 @@ static const Property aspeed_pcie_cfg_props[] = {
663 static void aspeed_pcie_cfg_class_init(ObjectClass *klass, const void *data)
664 {
665 DeviceClass *dc = DEVICE_CLASS(klass);
666 + ResettableClass *rc = RESETTABLE_CLASS(klass);
667 AspeedPCIECfgClass *apc = ASPEED_PCIE_CFG_CLASS(klass);
668
669 dc->desc = "ASPEED PCIe Config";
670 dc->realize = aspeed_pcie_cfg_realize;
671 dc->unrealize = aspeed_pcie_cfg_unrealize;
671 - device_class_set_legacy_reset(dc, aspeed_pcie_cfg_reset);
672 + rc->phases.hold = aspeed_pcie_cfg_reset_hold;
673 device_class_set_props(dc, aspeed_pcie_cfg_props);
674
675 apc->reg_ops = &aspeed_pcie_cfg_ops;
@@ -870,9 +871,9 @@ static const MemoryRegionOps aspeed_pcie_phy_ops = {
871 },
872 };
873
873 -static void aspeed_pcie_phy_reset(DeviceState *dev)
874 +static void aspeed_pcie_phy_reset_hold(Object *obj, ResetType type)
875 {
875 - AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(dev);
876 + AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(obj);
877 AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_GET_CLASS(s);
878
879 memset(s->regs, 0, apc->nr_regs << 2);
@@ -913,12 +914,13 @@ static const Property aspeed_pcie_phy_props[] = {
914 static void aspeed_pcie_phy_class_init(ObjectClass *klass, const void *data)
915 {
916 DeviceClass *dc = DEVICE_CLASS(klass);
917 + ResettableClass *rc = RESETTABLE_CLASS(klass);
918 AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_CLASS(klass);
919
920 dc->desc = "ASPEED PCIe Phy";
921 dc->realize = aspeed_pcie_phy_realize;
922 dc->unrealize = aspeed_pcie_phy_unrealize;
921 - device_class_set_legacy_reset(dc, aspeed_pcie_phy_reset);
923 + rc->phases.hold = aspeed_pcie_phy_reset_hold;
924 device_class_set_props(dc, aspeed_pcie_phy_props);
925
926 apc->nr_regs = 0x100 >> 2;
@@ -932,9 +934,9 @@ static const TypeInfo aspeed_pcie_phy_info = {
934 .class_size = sizeof(AspeedPCIEPhyClass),
935 };
936
935 -static void aspeed_2700_pcie_phy_reset(DeviceState *dev)
937 +static void aspeed_2700_pcie_phy_reset_hold(Object *obj, ResetType type)
938 {
937 - AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(dev);
939 + AspeedPCIEPhyState *s = ASPEED_PCIE_PHY(obj);
940 AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_GET_CLASS(s);
941
942 memset(s->regs, 0, apc->nr_regs << 2);
@@ -950,10 +952,11 @@ static void aspeed_2700_pcie_phy_class_init(ObjectClass *klass,
952 const void *data)
953 {
954 DeviceClass *dc = DEVICE_CLASS(klass);
955 + ResettableClass *rc = RESETTABLE_CLASS(klass);
956 AspeedPCIEPhyClass *apc = ASPEED_PCIE_PHY_CLASS(klass);
957
958 dc->desc = "ASPEED AST2700 PCIe Phy";
956 - device_class_set_legacy_reset(dc, aspeed_2700_pcie_phy_reset);
959 + rc->phases.hold = aspeed_2700_pcie_phy_reset_hold;
960
961 apc->nr_regs = 0x800 >> 2;
962 }