Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4332824pxt; Wed, 11 Aug 2021 03:42:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQEwhi0koAfn+KisdwZ/LODdAc7CDFyjZguXgGbZFcbk1hgayVHxxCmshvl7B+rCyA2IET X-Received: by 2002:a05:6402:4243:: with SMTP id g3mr10777448edb.254.1628678548260; Wed, 11 Aug 2021 03:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628678548; cv=none; d=google.com; s=arc-20160816; b=zvayOkGbpvI+V7V6YyNgD3NBhAkR5M4b9S4xKuQzKRhYLWwmrZG0L45vtAZ4oY2jyO zwJ3+b91mip+NzX0eM/A9amUuWJCdEoxq/m+2jhmN9/Eq4ldF33yGSyCgHEsiZ8SYdHj wDtzpE2uV8ebNA5VR/yCWIn6UZqVM6btSAkd0KRN4lQwag3dNNNvUZ0LnBKgtUcPkf+7 B1guzf/CYDEIDH83b/63R1VUT/2tTOmMouFF385ffF3fnJ8SmHSUYorWBNLq6dDBORKq sVTTzS7IDrULE8mPg+1fkx4iiMrLJFQ3eUSdHBQmttGGenbHv7yL21SH9hBpZR6EYJAE TSlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2VU2iZB7uloSAbAsw2KtmxdV1Ei9zpIoU6F3iofUygo=; b=dpvfwMjA371NiW826cy/lceImFbxVwAnBfrDj9tJ3pt81o0WkNYJ8h0YxeAY4ZKudv IZYh1tfAx/RyrvfKyxFB1qPR1WKMkGl0ZQw52ulUSl9xw2lTbEn8BD/AgC9DHKhhXWAz uk3Bd0JQthoVI2IHchu+BJnXso/83j6YGoS197ApOnK3S/LjUAt3zoXKwOJTCw4IyyJl 5xC/Yu9PNLSdcG2GrBx5kF1ZmLi19rgz9t4Ij6AmMwwDxkuqT+jq4YLgMlZ5uQHg6yJU M6KLmUtFBnU5c3ThdoSlt7ydQFBkNsiOht+FkegHVwcuuKEkKacstDO8RT9aTU36kQxy PjPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rr1TiTfX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a18si21918559ejj.147.2021.08.11.03.42.05; Wed, 11 Aug 2021 03:42:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rr1TiTfX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237021AbhHKKlF (ORCPT + 99 others); Wed, 11 Aug 2021 06:41:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:32938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237020AbhHKKlD (ORCPT ); Wed, 11 Aug 2021 06:41:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7510E60FC3; Wed, 11 Aug 2021 10:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628678440; bh=MWYsgBQRSHA52IzMe7OkpIpL0S/lsPWSSoypLj4ev5U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Rr1TiTfXf7kLOQpQAnQMdTKvb6FpJYfiHlPfyzDC4BKNBKnfDcpZ9OG+/ZJp9vnbr wmd1JllIpx58JrGj8ML5wvwuqRavxJYmGploaSGWxXf1IMRymCIWH10rXuxE9LNP/O S2EC8BP3gDFFvXb0lVvxILCj5uZtsb6D9yoJv1/DIGty6+XC9NZzzYrMQwDTJU9nk5 +mcCaIHWLxitlQEl4VoDnTRI5G4f3os+LI/Z7+P0B4opUuY0f04Wdtl8hZjq8uxcpZ WIRJPnQ9iBo7qQjrkPz471mys1stPbA/eX8LkxC112c6GbNaG+EsMoK0MUuizBy2ZF muzSJ66j45toQ== Received: by mail-ot1-f42.google.com with SMTP id r19-20020a0568301353b029050aa53c3801so2804125otq.2; Wed, 11 Aug 2021 03:40:40 -0700 (PDT) X-Gm-Message-State: AOAM530gMrw8T/fpWJt+4PH5OMA01axVn5cSFwdiv12dK3JdKxj0L5H0 vXzboY32cMAKKRW3ocvN5akTISaxCSgC5wultWQ= X-Received: by 2002:a9d:5cc7:: with SMTP id r7mr8041809oti.108.1628678439823; Wed, 11 Aug 2021 03:40:39 -0700 (PDT) MIME-Version: 1.0 References: <20210726100026.12538-1-lorenzo.pieralisi@arm.com> <20210802152359.12623-2-lorenzo.pieralisi@arm.com> In-Reply-To: From: Ard Biesheuvel Date: Wed, 11 Aug 2021 12:40:28 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/3] ACPI: osl: Add __force attribute in acpi_os_map_iomem() cast To: Christoph Hellwig Cc: Lorenzo Pieralisi , Linux Kernel Mailing List , "Rafael J. Wysocki" , ACPI Devel Maling List , Linux ARM , Veronika kabatova , Robin Murphy , Will Deacon , Hanjun Guo , Sudeep Holla , Catalin Marinas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 10 Aug 2021 at 18:46, Christoph Hellwig wrote: > > On Mon, Aug 02, 2021 at 04:23:57PM +0100, Lorenzo Pieralisi wrote: > > Add a __force attribute to the void* cast in acpi_os_map_iomem() > > to prevent sparse warnings. > > Err, no. These annotation are there for a reason and need to > be propagated instead. And independent of that a __force cast > without a comment explaining it is a complete no-go. The whole problem we are solving here is that ACPI, being based on x86, conflates MMIO mappings with memory mappings, and has been using the same underlying infrastructure for either. On arm64, this is not sufficient, given that the semantics of uncached memory vs device are different (the former permits unaligned accesses and clear cacheline instructions, but the latter doesn't). A recent optimization applied to memcpy() on arm64 (which now relies more on unaligned accesses for performance) has uncovered an issue where firmware tables being mapped non-cacheable by the ACPI core will end up using device mappings, which causes memcpy() to choke on their contents. So propagating the annotation makes no sense, as we are creating a memory mapping using the iomem primitive. I wouldn't object to a comment being added, but I think the context should have been obvious to anyone who had bothered to look at the entire series.