From nobody Sat Apr 27 09:01:08 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; Return-Path: Received: from mail.coreboot.org (80.81.252.135 [80.81.252.135]) by mx.zohomail.com with SMTPS id 1494427039339647.0890532655806; Wed, 10 May 2017 07:37:19 -0700 (PDT) Received: from [127.0.0.1] (helo=ra.coresystems.de) by mail.coreboot.org with esmtp (Exim 4.86_2) (envelope-from ) id 1d8SjY-0005X0-Fy; Wed, 10 May 2017 16:36:56 +0200 Received: from mga02.intel.com ([134.134.136.20]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.86_2) (envelope-from ) id 1d8Buc-0007Le-4g for seabios@seabios.org; Tue, 09 May 2017 22:39:31 +0200 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2017 13:39:09 -0700 Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga002.fm.intel.com with ESMTP; 09 May 2017 13:39:09 -0700 Received: from orsmsx112.amr.corp.intel.com ([169.254.3.213]) by ORSMSX101.amr.corp.intel.com ([169.254.8.57]) with mapi id 14.03.0319.002; Tue, 9 May 2017 13:39:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,316,1491289200"; d="scan'208";a="1166881563" From: "Xu, Anthony" To: "seabios@seabios.org" Thread-Topic: [SeaBIOS] A20: ahci_process_op is called with A20 off Thread-Index: AdLJBCS+DKq3qrcaTNakKXKBKL8kGA== Date: Tue, 9 May 2017 20:39:07 +0000 Message-ID: <4712D8F4B26E034E80552F30A67BE0B1AB31FB@ORSMSX112.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYmE2ZmFkOWQtOGUxYy00MzUzLTkwNWYtZGU1MGU1ODRkMTUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6Inc1aGZjalhCUnZORTlYbXN3aWhpa2Y5bVpGdVlEZU1MUG1nZU1GRTZUXC9rPSJ9 dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.22.254.140] MIME-Version: 1.0 X-Spam-Score: -6.0 (------) X-Mailman-Approved-At: Wed, 10 May 2017 16:36:54 +0200 Subject: [SeaBIOS] A20: ahci_process_op is called with A20 off X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Zhong, Yang" , "pbonzini@redhat.com" , "kraxel@redhat.com" Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Hi All, I recently met an issue, I can't boot my centos guest in below scenarios. I disabled kvmvapic by diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c index c3829e3..52be2b0 100644 --- a/hw/intc/apic_common.c +++ b/hw/intc/apic_common.c @@ -440,7 +440,7 @@ static const VMStateDescription vmstate_apic_common =3D= { static Property apic_properties_common[] =3D { DEFINE_PROP_UINT8("version", APICCommonState, version, 0x14), DEFINE_PROP_BIT("vapic", APICCommonState, vapic_control, VAPIC_ENABLE_= BIT, - true), + false), DEFINE_PROP_BOOL("legacy-instance-id", APICCommonState, legacy_instanc= e_id, false), DEFINE_PROP_END_OF_LIST(), I run Qemu in TCG mode ./x86_64-softmmu/qemu-system-x86_64 -bios /home/root/git/seabios/out/bios.b= in -machine q35=20 -m 1G -drive format=3Draw,file=3D/home/root/images/centos7.2.img,if=3Dide,= index=3D0 -nographic -nodefaults -serial stdio -monitor pty It can't boot with below message, " Booting from Hard Disk... WARNING - Timeout at ahci_command:154! Boot failed: could not read the boot disk enter handle_18: NULL Booting from Floppy... Boot failed: could not read the boot disk " Once I add kvmvapic , it can boot. I dig into seebios code, and found ahci_process_op is called with A20 off, The call trace is, process_op_16->process_op_both->call32->call32_smm->process_op_32->ahci_pro= cess_op call32_smm calls call32_prep, but because the method is C16_SMM, A20 is not= enabled in call32_prep. ahci_process_op is called with A20 off. ahci_process_op accesses memory mapped IO to operate ahci, the IO is mapped= to 0xfebff000,=20 because a20 is disabled, the bit 20 of 0xfebff000 is set 0 , which is 0xfe= aff000,=20 an iotlb entry mapping 0xfebff000 to 0xfeaff000 is added to iotlb cache. So= ahci_process_op actually accesses 0xfeaff000, it obviously won't work. target/i386/helper.c do_mapping: pte =3D pte & env->a20_mask; Why does guest boot with kvmvapic? In above scenario, there is no option roms. After adding kvmvapic, there is one option rom kvmvapic rom, and __callrom = is called for kvmvapic rom. __callrom->farcall16big-> call16_override, once call16_override is called, a20 is enabled and will not be disabled. So ahci_process_op is called with a20 on. I tried below change, guest can boot without kvmvapic. I'm not familiar wi= th seabios code,=20 I don't consider it as a patch, but it proves my analysis is correct. With = the change, __call32 calls call32_prep with method C16_BIG to enable a20 before calling ahci_process_= op. please help fix this issue. Thanks, Anthony diff --git a/src/stacks.c b/src/stacks.c index ef6a707..0949652 100644 --- a/src/stacks.c +++ b/src/stacks.c @@ -232,10 +237,11 @@ u32 VISIBLE16 __call32(void *func, u32 eax, u32 errret) { ASSERT16(); - if (CONFIG_CALL32_SMM && GET_GLOBAL(HaveSmmCall32)) - return call32_smm(func, eax); +// if (CONFIG_CALL32_SMM && GET_GLOBAL(HaveSmmCall32)) +// return call32_smm(func, eax); // Jump direclty to 32bit mode - this clobbers the 16bit segment // selector registers. _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios