acpi/core: always set SCI_EN when SMM isn't supported
If SMM is not supported, ACPI fixed hardware doesn't support legacy-mode. ACPI-only platform. Where SCI_EN in PM1_CNT register is always set. The bit tells OS legacy mode(SCI_EN cleared) or ACPI mode(SCI_EN set). With the next patch (setting fadt.smi_cmd = 0 when smm isn't enabled), guest Linux tries to switch to ACPI mode, finds smi_cmd = 0, and then fails to initialize acpi subsystem. This patch proactively fixes it. This patch changes guest ABI. To keep compatibility, use "smm-compat" introduced by earlier patch. If the property is true, disable new behavior. ACPI spec 4.8.10.1 PM1 Event Grouping PM1 Eanble Registers > For ACPI-only platforms (where SCI_EN is always set) Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> Message-Id: <500f62081626997e46f96377393d3662211763a8.1613615732.git.isaku.yamahata@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
		
							parent
							
								
									24cd04fce0
								
							
						
					
					
						commit
						6be8cf56bc
					
				| @ -579,6 +579,10 @@ void acpi_pm1_cnt_update(ACPIREGS *ar, | ||||
|                          bool sci_enable, bool sci_disable) | ||||
| { | ||||
|     /* ACPI specs 3.0, 4.7.2.5 */ | ||||
|     if (ar->pm1.cnt.acpi_only) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     if (sci_enable) { | ||||
|         ar->pm1.cnt.cnt |= ACPI_BITMASK_SCI_ENABLE; | ||||
|     } else if (sci_disable) { | ||||
| @ -608,11 +612,13 @@ static const MemoryRegionOps acpi_pm_cnt_ops = { | ||||
| }; | ||||
| 
 | ||||
| void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, | ||||
|                        bool disable_s3, bool disable_s4, uint8_t s4_val) | ||||
|                        bool disable_s3, bool disable_s4, uint8_t s4_val, | ||||
|                        bool acpi_only) | ||||
| { | ||||
|     FWCfgState *fw_cfg; | ||||
| 
 | ||||
|     ar->pm1.cnt.s4_val = s4_val; | ||||
|     ar->pm1.cnt.acpi_only = acpi_only; | ||||
|     ar->wakeup.notify = acpi_notify_wakeup; | ||||
|     qemu_register_wakeup_notifier(&ar->wakeup); | ||||
| 
 | ||||
| @ -638,6 +644,9 @@ void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, | ||||
| void acpi_pm1_cnt_reset(ACPIREGS *ar) | ||||
| { | ||||
|     ar->pm1.cnt.cnt = 0; | ||||
|     if (ar->pm1.cnt.acpi_only) { | ||||
|         ar->pm1.cnt.cnt |= ACPI_BITMASK_SCI_ENABLE; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| /* ACPI GPE */ | ||||
|  | ||||
| @ -282,7 +282,7 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, | ||||
|     acpi_pm_tmr_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io); | ||||
|     acpi_pm1_evt_init(&pm->acpi_regs, ich9_pm_update_sci_fn, &pm->io); | ||||
|     acpi_pm1_cnt_init(&pm->acpi_regs, &pm->io, pm->disable_s3, pm->disable_s4, | ||||
|                       pm->s4_val); | ||||
|                       pm->s4_val, !pm->smm_compat && !smm_enabled); | ||||
| 
 | ||||
|     acpi_gpe_init(&pm->acpi_regs, ICH9_PMIO_GPE0_LEN); | ||||
|     memory_region_init_io(&pm->io_gpe, OBJECT(lpc_pci), &ich9_gpe_ops, pm, | ||||
|  | ||||
| @ -497,7 +497,8 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp) | ||||
| 
 | ||||
|     acpi_pm_tmr_init(&s->ar, pm_tmr_timer, &s->io); | ||||
|     acpi_pm1_evt_init(&s->ar, pm_tmr_timer, &s->io); | ||||
|     acpi_pm1_cnt_init(&s->ar, &s->io, s->disable_s3, s->disable_s4, s->s4_val); | ||||
|     acpi_pm1_cnt_init(&s->ar, &s->io, s->disable_s3, s->disable_s4, s->s4_val, | ||||
|                       !s->smm_compat && !s->smm_enabled); | ||||
|     acpi_gpe_init(&s->ar, GPE_LEN); | ||||
| 
 | ||||
|     s->powerdown_notifier.notify = piix4_pm_powerdown_req; | ||||
|  | ||||
| @ -36,7 +36,10 @@ | ||||
| #include "hw/virtio/virtio.h" | ||||
| #include "hw/virtio/virtio-pci.h" | ||||
| 
 | ||||
| GlobalProperty hw_compat_5_2[] = {}; | ||||
| GlobalProperty hw_compat_5_2[] = { | ||||
|     { "ICH9-LPC", "smm-compat", "on"}, | ||||
|     { "PIIX4_PM", "smm-compat", "on"}, | ||||
| }; | ||||
| const size_t hw_compat_5_2_len = G_N_ELEMENTS(hw_compat_5_2); | ||||
| 
 | ||||
| GlobalProperty hw_compat_5_1[] = { | ||||
|  | ||||
| @ -190,7 +190,7 @@ static void via_pm_realize(PCIDevice *dev, Error **errp) | ||||
| 
 | ||||
|     acpi_pm_tmr_init(&s->ar, pm_tmr_timer, &s->io); | ||||
|     acpi_pm1_evt_init(&s->ar, pm_tmr_timer, &s->io); | ||||
|     acpi_pm1_cnt_init(&s->ar, &s->io, false, false, 2); | ||||
|     acpi_pm1_cnt_init(&s->ar, &s->io, false, false, 2, false); | ||||
| } | ||||
| 
 | ||||
| typedef struct via_pm_init_info { | ||||
|  | ||||
| @ -128,6 +128,7 @@ struct ACPIPM1CNT { | ||||
|     MemoryRegion io; | ||||
|     uint16_t cnt; | ||||
|     uint8_t s4_val; | ||||
|     bool acpi_only; | ||||
| }; | ||||
| 
 | ||||
| struct ACPIGPE { | ||||
| @ -163,7 +164,8 @@ void acpi_pm1_evt_init(ACPIREGS *ar, acpi_update_sci_fn update_sci, | ||||
| 
 | ||||
| /* PM1a_CNT: piix and ich9 don't implement PM1b CNT. */ | ||||
| void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, | ||||
|                        bool disable_s3, bool disable_s4, uint8_t s4_val); | ||||
|                        bool disable_s3, bool disable_s4, uint8_t s4_val, | ||||
|                        bool acpi_only); | ||||
| void acpi_pm1_cnt_update(ACPIREGS *ar, | ||||
|                          bool sci_enable, bool sci_disable); | ||||
| void acpi_pm1_cnt_reset(ACPIREGS *ar); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Isaku Yamahata
						Isaku Yamahata