From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CE06351C3B for ; Fri, 6 Mar 2026 18:26:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772821597; cv=none; b=nOBrxvCNoO93N5tXVtz83qwKSS6lHvqRav1IhNmeJ0EpT5cqBqnLPBbMCoeaZToWQXekFp5xq3z/+/V5cth0jG+BZFeS6NkLLmtN5oct7YjfVhMB8uLN9b0VLQPsN2tc7zwkWRa7fbqGRMiBTlz0XGpoVA5jqIqX4ZNsPNvbRxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772821597; c=relaxed/simple; bh=zMZGOuXiGCevuzUnX9PRRD6DzzqKa/JULNFn2FDPY5I=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=UmN+z/O8CzyGI5SG/tFMrcBKhcKuvG5moRF2LmUqFSGTluHc7X50fsn/PRvWwib+vi4cJ30D/fxVKILd2lPp5uvSv+OqeA7XAxYfSwofs7XVLwrnnz4wSEqTDUgoBgLM6aA2gakxd/q5EFd9LJovM8M3gIYMBov8APocNS1PLRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 BBB52497; Fri, 6 Mar 2026 10:26:29 -0800 (PST) Received: from [10.1.196.96] (eglon.cambridge.arm.com [10.1.196.96]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F2A313F7BD; Fri, 6 Mar 2026 10:26:34 -0800 (PST) Message-ID: <969b0700-9603-4e1c-b15c-e509e4d1b0ce@arm.com> Date: Fri, 6 Mar 2026 18:26:32 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] arm_mpam: Force __iomem casts To: Krzysztof Kozlowski , Ben Horgan , Reinette Chatre , Fenghua Yu , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20260216110240.159691-3-krzysztof.kozlowski@oss.qualcomm.com> <7b5e4218-5961-4874-bbb1-89770cd2c744@arm.com> <18f3f73a-9bc6-4518-b3e4-730fa0793146@oss.qualcomm.com> Content-Language: en-GB From: James Morse In-Reply-To: <18f3f73a-9bc6-4518-b3e4-730fa0793146@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Krzysztof, Ben, On 27/02/2026 14:51, Krzysztof Kozlowski wrote: > On 27/02/2026 15:06, Ben Horgan wrote: >> On 2/16/26 11:02, Krzysztof Kozlowski wrote: >>> Code allocates standard kernel memory to pass to the MPAM, which expects >>> __iomem. The code is safe, because __iomem accessors should work fine >>> on kernel mapped memory, however leads to sparse warnings: >>> >>> test_mpam_devices.c:327:42: warning: incorrect type in initializer (different address spaces) >>> test_mpam_devices.c:327:42: expected char [noderef] __iomem *buf >>> test_mpam_devices.c:327:42: got void * >>> test_mpam_devices.c:342:24: warning: cast removes address space '__iomem' of expression >>> >>> Cast the pointer to memory via __force to silence them. >>> diff --git a/drivers/resctrl/test_mpam_devices.c b/drivers/resctrl/test_mpam_devices.c >>> index 3e8d564a0c64..2de41b47c138 100644 >>> --- a/drivers/resctrl/test_mpam_devices.c >>> +++ b/drivers/resctrl/test_mpam_devices.c >>> @@ -324,7 +324,7 @@ static void test_mpam_enable_merge_features(struct kunit *test) >>> >>> static void test_mpam_reset_msc_bitmap(struct kunit *test) >>> { >>> - char __iomem *buf = kunit_kzalloc(test, SZ_16K, GFP_KERNEL); >>> + char __iomem *buf = (__force char __iomem *)kunit_kzalloc(test, SZ_16K, GFP_KERNEL); >>> struct mpam_msc fake_msc = {}; >>> u32 *test_result; >>> >> This change looks good to me. [...] >> Acked-by: Ben Horgan Thanks! I've picked this for a fixes branch. I'm not sure what Will or Catalin will think this needs fixing during the release as the driver is behind CONFIG_EXPERT. I'll ask... Thanks, James