Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1812591imu; Thu, 17 Jan 2019 03:44:55 -0800 (PST) X-Google-Smtp-Source: ALg8bN5lZ6/x2GGMc+aGzHoC8AlJfilnE2aH8pmrAFbpYUdZYGCtFCRNffxYzrr6USipSSfMVRly X-Received: by 2002:a62:30c3:: with SMTP id w186mr14632552pfw.39.1547725495423; Thu, 17 Jan 2019 03:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547725495; cv=none; d=google.com; s=arc-20160816; b=U0jTuj3DEaHVVj6RgIcLFO7qFL+nSNN/wf2+uBTRQa6TO7KnR3+JsBQz9n7qLT0VAj mx3R1oYUXQ8ZA2+taW+nny5VPUdYb/wuES6/GDEtMX0GkBNEohZAOehKipPseV1i65NE DEOmd/Eo0JoSQF3bi58sRphvHeMEsbJNx9fqwp1ooPX2jN/VMqiKwQzRe2xYZyPj0FBg qqZ+xuO7fDho/I09quPx+hD/DoVeB93/ktnClt7/+Ikw4bAGoHvSfgvTFW3VWqBWj3AK h86mtjPou4ejXJru3ja1hp/GxDIen8sPuU92JsSpfA0FSIMhKcTg6mjrcrbpq/bZFDfP I6DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject; bh=nhbTlQNKMxsyvZFW2LYv3U+8Kt7rog6kpIUj87JHLoI=; b=yLtDCuopJ9uHXeB5EjPfLjn7etIcmtyvUgBUKTCfm9vV7F68rcCJ3GT3am4Ahj8vME zfvUPEtUAaGmVtf2fCfQWtOUx7Q+iUyd5o6G6RrEOBK/5xXJUm0OEoXOe7mZKMN9G0zp 0gXY50rH5Fzj4z1g3G3maxLJetYyFf3v96DlgRl7epE+3fP30BhWDmJQvBUM68BB1nhL zt1cNuxqPR0ht52nE65J1jlseeUkxXOrh419xx+G799D7nEUSQdj+BlasjFlqBmSHuNc gytlxeYjjWJXp0PFPaFosDUCZvZaszeF0ndovLpYBavI68OcpM00wOSJ7pmb8mMIQdJ0 GhPQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4si1266063pgg.492.2019.01.17.03.44.39; Thu, 17 Jan 2019 03:44:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbfAQJG5 (ORCPT + 99 others); Thu, 17 Jan 2019 04:06:57 -0500 Received: from mx2.suse.de ([195.135.220.15]:43088 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727510AbfAQJGy (ORCPT ); Thu, 17 Jan 2019 04:06:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 24958ACB1; Thu, 17 Jan 2019 09:06:51 +0000 (UTC) Subject: Re: [PATCH v15 5/6] x86/boot: Parse SRAT address from RSDP and store immovable memory To: Kairui Song , Chao Fan Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, Kees Cook , Baoquan He , msys.mizuma@gmail.com, indou.takao@jp.fujitsu.com, caoj.fnst@cn.fujitsu.com References: <20190107032243.25324-1-fanc.fnst@cn.fujitsu.com> <20190107032243.25324-6-fanc.fnst@cn.fujitsu.com> <20190117062451.GA588@localhost.localdomain> <20190117075729.GC31097@localhost.localdomain> From: Juergen Gross Openpgp: preference=signencrypt Autocrypt: addr=jgross@suse.com; prefer-encrypt=mutual; keydata= xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjrioyspZKOB ycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2kaV2KL9650I1SJve dYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i1TXkH09XSSI8mEQ/ouNcMvIJ NwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/BBLUVbDa4+gmzDC9ezlZkTZG2t14zWPvx XP3FAp2pkW0xqG7/377qptDmrk42GlSKN4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEB AAHNHkp1ZXJnZW4gR3Jvc3MgPGpncm9zc0BzdXNlLmRlPsLAeQQTAQIAIwUCU4xw6wIbAwcL CQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAAAoJELDendYovxMvi4UH/Ri+OXlObzqMANruTd4N zmVBAZgx1VW6jLc8JZjQuJPSsd/a+bNr3BZeLV6lu4Pf1Yl2Log129EX1KWYiFFvPbIiq5M5 kOXTO8Eas4CaScCvAZ9jCMQCgK3pFqYgirwTgfwnPtxFxO/F3ZcS8jovza5khkSKL9JGq8Nk czDTruQ/oy0WUHdUr9uwEfiD9yPFOGqp4S6cISuzBMvaAiC5YGdUGXuPZKXLpnGSjkZswUzY d9BVSitRL5ldsQCg6GhDoEAeIhUC4SQnT9SOWkoDOSFRXZ+7+WIBGLiWMd+yKDdRG5RyP/8f 3tgGiB6cyuYfPDRGsELGjUaTUq3H2xZgIPfOwE0EU4xwFgEIAMsx+gDjgzAY4H1hPVXgoLK8 B93sTQFN9oC6tsb46VpxyLPfJ3T1A6Z6MVkLoCejKTJ3K9MUsBZhxIJ0hIyvzwI6aYJsnOew cCiCN7FeKJ/oA1R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2fPCI2/hxf2oqXPYbKr1v4Z1wthmoyUgGN0LPTIm+B5vdY82wI5qe9uN6UOGyTH2B3p hRQUWqCwu2sqkI3LLbTdrnyDZaixT2T0f4tyF5Lfs+Ha8xVMhIyzNb1byDI5FKCb Message-ID: Date: Thu, 17 Jan 2019 10:06:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/01/2019 09:22, Kairui Song wrote: > On Thu, Jan 17, 2019 at 3:58 PM Chao Fan wrote: >> >> On Wed, Jan 16, 2019 at 03:28:52PM +0800, Kairui Song wrote: >>> On Mon, Jan 7, 2019 at 11:24 AM Chao Fan wrote: >>>> >>>> + >>>> +/* Determine RSDP, based on acpi_os_get_root_pointer(). */ >>>> +static acpi_physical_address get_rsdp_addr(void) >>>> +{ >>>> + acpi_physical_address pa; >>>> + >>>> + pa = get_acpi_rsdp(); >>>> + >>>> + if (!pa) >>>> + pa = efi_get_rsdp_addr(); >>>> + >>>> + if (!pa) >>>> + pa = bios_get_rsdp_addr(); >>>> + >>>> + return pa; >>>> +} >>> >>> acpi_rsdp might be provided by boot_params.acpi_rsdp_addr too, >>> it's introduced in ae7e1238e68f2a for Xen PVH guest and later move to >>> boot_params in e6e094e053af, >>> kexec could use it to pass RSDP to second kernel as well. Please check >>> it as well make sure it always works. >>> >> >> Hi Kairui, >> >> I saw the parsing code has been added to kernel, but I didn't see >> where to fill in the 'acpi_rsdp_addr'. If only you(KEXEC) use it, >> I can add "#ifdef CONFIG_KEXEC", but you said Xen will use it also, >> so I didn't add ifdef to control it. I was trying to do as below: >> >> static inline acpi_physical_address get_boot_params_rsdp(void) >> { >> return boot_params->acpi_rsdp_addr; >> } >> >> static acpi_physical_address get_rsdp_addr(void) >> { >> bool boot_params_rsdp_exist; >> acpi_physical_address pa; >> >> pa = get_acpi_rsdp(); >> >> if (!pa) >> pa = get_boot_params_rsdp(); >> >> if (!pa) { >> pa = efi_get_rsdp_addr(); >> boot_params_rsdp_exist = false; >> } >> else >> boot_params_rsdp_exist = true; >> >> if (!pa) >> pa = bios_get_rsdp_addr(); >> >> if (pa && !boot_params_rsdp_exist) >> boot_params.acpi_rsdp_addr = pa; >> >> return pa; >> } >> >> At the same time, I notice kernel only parses it when >> "#ifdef CONFIG_ACPI", we should keep sync with kernel, but I think >> we are parsing SRAT, CONFIG_ACPI is needed sure, so I am going to >> update the define of EARLY_SRAT_PARSE: >> >> config EARLY_SRAT_PARSE >> bool "EARLY SRAT parsing" >> def_bool y >> depends on RANDOMIZE_BASE && MEMORY_HOTREMOVE && ACPI >> >> Boris, how do you think the update for the new acpi_rsdp_addr? >> If I misunderstand something, please let me know. >> >> Thanks, >> Chao Fan >> > > Hi, thanks for considering kexec usage, > > but I think "boot_params_rsdp_exist" is not necessary, > boot_params->acpi_rsdp_addr should be either NULL or a valid value if > I, later initialization code considers it a valid value if it's not > NULL. > > For the usage for Xen I'm not sure either, the info comes from commit > message of ae7e1238e68f2a that's also where boot_params.acpi_rsdp_addr > is first introduced, lets cc Juergen as well. Thanks for adding me. The Xen case is thought to prefer boot_params->acpi_rsdp_addr over all other possibilities if set. This logic should be kept. It is used for Xen PVH guests booted via grub2. Xen PVH guests don't have RSDP in low memory, so this interface is needed. In any case you should first try acpi_arch_get_root_pointer() as this is the preferred way to override RSDP address. Juergen