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 1672541C31C for ; Fri, 27 Feb 2026 14:06:30 +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=1772201191; cv=none; b=NAwqfWbPjT8Me09xKSzjikkcJA6fURoLrbYRALJsgK6HwJILLC1RyVkR4lQ/u31ZnCNVPtdjUgyBNp+U+UtFsJy7fHCvLfVDZk/qP16WW52yRl0m9OHndkhHMkfyNtpOh5i5wVY0tEshYqPIpfH2QbqUpHmzC3ENeETAEAyer2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772201191; c=relaxed/simple; bh=EfKF/7v+Nyrgaov08DVHDKSDHK4576W2I54TAlE66sg=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=CgnOd0UQ9tmR7Ups5rGBYHk5xSRAP11PtXPmM4deMh+Q/xa7qgIPDX0qeUDUzLwpqhzjT8Puq+FIs8hskAbpWVX70buh7quefHPCIvVUdccSt7+FcUihrScV8HJ6GsNRIJNPIkDMiHZNfgjhjfk2MRjWizFEcPIRoCZnXk2iupQ= 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 6953E14BF; Fri, 27 Feb 2026 06:06:23 -0800 (PST) Received: from [10.1.196.46] (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9AD2F3F62B; Fri, 27 Feb 2026 06:06:28 -0800 (PST) Message-ID: <7b5e4218-5961-4874-bbb1-89770cd2c744@arm.com> Date: Fri, 27 Feb 2026 14:06:27 +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 , James Morse , 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> From: Ben Horgan Content-Language: en-US In-Reply-To: <20260216110240.159691-3-krzysztof.kozlowski@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Krzysztof, 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. > > Signed-off-by: Krzysztof Kozlowski > --- > drivers/resctrl/test_mpam_devices.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > 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; > > @@ -339,7 +339,7 @@ static void test_mpam_reset_msc_bitmap(struct kunit *test) > mutex_init(&fake_msc.part_sel_lock); > mutex_lock(&fake_msc.part_sel_lock); > > - test_result = (u32 *)(buf + MPAMCFG_CPBM); > + test_result = (__force u32 *)(buf + MPAMCFG_CPBM); > > mpam_reset_msc_bitmap(&fake_msc, MPAMCFG_CPBM, 0); > KUNIT_EXPECT_EQ(test, test_result[0], 0); This change looks good to me. As sparse is more broken I needed to use the patch from [1] to reproduce this. Copied here for convenience. diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 2b30a0529d48..90536b2bc42e 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -14,8 +14,8 @@ struct vm_area_struct; struct mempolicy; /* Helper macro to avoid gfp flags if they are the default one */ -#define __default_gfp(a,...) a -#define default_gfp(...) __default_gfp(__VA_ARGS__ __VA_OPT__(,) GFP_KERNEL) +#define __default_gfp(a,b,...) b +#define default_gfp(...) __default_gfp(,##__VA_ARGS__,GFP_KERNEL) /* Convert GFP flags to their corresponding migrate type */ #define GFP_MOVABLE_MASK (__GFP_RECLAIMABLE|__GFP_MOVABLE) There is a kernel test robot report [2] and that asks for these tags: Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202512160133.eAzPdJv2-lkp@intel.com/ Acked-by: Ben Horgan [1] https://lore.kernel.org/all/CAHk-=wijD-giccF6sJ+BdJpGDX9kPEUT6kryaQG0GRyJ3QQwng@mail.gmail.com/ [2] https://lore.kernel.org/all/202512160133.eAzPdJv2-lkp@intel.com/ Thanks, Ben