Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp569087ybb; Wed, 1 Apr 2020 05:45:15 -0700 (PDT) X-Google-Smtp-Source: APiQypIlmfxFm1HKqgO38dFj/TLZAVqWvxP2S69TpelLqtrwusp4H7oprZXajcicc+q/oh4KM7X3 X-Received: by 2002:a05:6808:43:: with SMTP id v3mr2665434oic.59.1585745115125; Wed, 01 Apr 2020 05:45:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585745115; cv=none; d=google.com; s=arc-20160816; b=laQn0PJpMxvlN/i7Cyj/Gr9NBT80CXR2ISlDPlZZ+lslNFGDqw+hx1sjo8scNTUdq7 9yPptZ8weF8HatFzk/oBzZixs/XWp/olEjDqSltLbDgmyzS85FMq/a31vGLAkc8BoWGm y6JtCvYzHlnFJN1YSTPQpxfypfGWAguUoq/4Q+qBJGUap1Aec2EmG8wwFRFSPlY8F/j0 R+asb6y9dp9tOEUupwyqOWUvB5vrWTl2PxdBFaTHh1Pbwpjr9OqVJj7LSgCccb38jUGS F/o3FMd6nuT4q9CeiOT5z2k7muMgAyzkxR4TD8cPXgWEybZIgbnS5zO+VIedY/3cDqsQ 0bIQ== 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:openpgp:from:references:cc:to:subject; bh=kerve/Z66jHTIGUBPmcjcmuFEs//dIGrqmu6EuAROJs=; b=Lp5voj+aBbNorMpG3fcSO6Ko2VJ6ylZv0RL4TPmASKeYvF9gln8zL7qn6DTyzUHJPR Z8DfvH/tp9qmC9ppBu4L0Krnk8sZnUyKjZpwgWya5ILfo2gCQzpx0b4oNl2E1OenkkaY mRExa84NyPbEcrCJ3tEUWp1STMPLkyiFw22COKmHlYCDRrgOSZhBgGhaHUL0OhNjSFhy asZIN7tcAjRMeHXaPfvFzfpDeAQvPANJzX2cOZPk1hTchOwJY52iuLyjAMES2ca7fhPa /mdoyRTU2a/8kcyHOvbHHgyFFS5ae/6RPMETvxgyxENV0k8XRY44IyNHbqRDCfraWKbL GT5w== 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 f129si835579oia.243.2020.04.01.05.45.01; Wed, 01 Apr 2020 05:45:15 -0700 (PDT) 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 S1732514AbgDAMoi (ORCPT + 99 others); Wed, 1 Apr 2020 08:44:38 -0400 Received: from foss.arm.com ([217.140.110.172]:50902 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732396AbgDAMoi (ORCPT ); Wed, 1 Apr 2020 08:44:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 908AC30E; Wed, 1 Apr 2020 05:44:37 -0700 (PDT) Received: from [172.16.1.108] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1B43B3F68F; Wed, 1 Apr 2020 05:44:35 -0700 (PDT) Subject: Re: [PATCH][V2] ACPI: sysfs: copy ACPI data using io memory copying To: Mark Rutland , Colin King Cc: "Rafael J . Wysocki" , Len Brown , Alexander Viro , Andrew Morton , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, lorenzo.pieralisi@arm.com References: <20200317165409.469013-1-colin.king@canonical.com> <20200320131951.GA6555@lakrids.cambridge.arm.com> From: James Morse Openpgp: preference=signencrypt Message-ID: <698da6fc-3334-5420-5c97-4406914e4599@arm.com> Date: Wed, 1 Apr 2020 13:44:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200320131951.GA6555@lakrids.cambridge.arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On 3/20/20 1:19 PM, Mark Rutland wrote: > [adding James and Lorenzo] (but not actually...) > On Tue, Mar 17, 2020 at 04:54:09PM +0000, Colin King wrote: >> From: Colin Ian King >> >> Reading ACPI data on ARM64 at a non-aligned offset from >> /sys/firmware/acpi/tables/data/BERT will cause a splat because >> the data is I/O memory mapped On your platform, on someone else's it may be in memory. Which platform is this on? (I've never seen one generate a BERT!) >> and being read with just a memcpy. >> Fix this by introducing an I/O variant of memory_read_from_buffer >> and using I/O memory mapped copies instead. > Just to check, is that correct is it correct to map those tables with > Device attributes in the first place, or should we be mapping the tables > with Normal Cacheable attributes with memremap()? > > If the FW placed those into memory using cacheavble attributes, reading > them using Device attributes could result in stale values, which could > be garbage. Yes. The BERT code should be using arch_apei_get_mem_attribute() to use the correct attributes. See ghes_map() for an example. bert_init() will need to use a version of ioremap() that takes the pgprot_t. Always using ioremap_cache() means you get a cacheable mapping, regardless of how firmware described this region in the UEFI memory map. This doesn't explain why you got an alignment fault. Otherwise, looks fine to me. (N.B. I ignored this patch as it wasn't copied to linux-arm-kernel and the subject says its about sysfs<->ACPI, nothing to do with APEI!) Thanks, James