From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A9123E3DAE for ; Wed, 13 May 2026 08:53:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778662389; cv=none; b=dqNLs4LSpro96YDZ0LqvL2ik72CuqATjje4Ajw5cV1jU8UmW9dWeqU/hcgG5FcZUgl2CYxcl0qb768Z6lkrPZsmovYlTcpvk/VkkLOKP1qP7uePcYApqnfU3d8Vc1xp1K/gXoG5BenkbgtCfORDXTxYmnfLtu5NBPnEXaCHIGWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778662389; c=relaxed/simple; bh=vO2Fq6n7DMfc4owJztYq4f21UxNQ3yHxFKI4nhD0l6g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=mHhhFD8VwpqGhhtZs68sub9IA9XNoQoMTMhVjH3giY5gF5OI0W5wvSMx4NxBIu50fJzesGg1RB/UFUuGaDV57MoBrutPAD07GNUWzcG4nv+Lgkbs2BP17N49VBHek34kcrCie8DaL3CM1x2fnhWcHx1ky4skuvsDlJ8pHu8FXlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ihk647Q6; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ihk647Q6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35477C2BCB7; Wed, 13 May 2026 08:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778662389; bh=vO2Fq6n7DMfc4owJztYq4f21UxNQ3yHxFKI4nhD0l6g=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Ihk647Q6Z+znMSZqQNrJ9GSxCrIzUL2H+uKMZ75jjuImKW+uYTPsSMbowS7zyr776 cdY13jsSyBYIt5eQGjSqQXL/BUdAx/ZcHFa55g9sIBfkUapvPhYtbx/uL9ktd2y7dy DbJM/6IdzBYa4tyR+adRFhRsQrthR5aocBEtPklEZEOfEsNiqQeQ/xQaP84peePQVH 16IgJTQLJNsCxjQYkLt6G+qCVp9fdxNHnfksny07l3AfH9URzTMFvpRIt+yOzFufqV fX/Lx4WloXyuOjjZ7nMHnfA++zdiO4ZXFpLzRpQeLMKnYMntm4X5mFWNS64AqupWkD RG1U+BM3+7KRA== X-Mailer: emacs 30.2 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Greg KH Cc: Catalin Marinas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jeremy Linton , Jonathan Cameron , Lorenzo Pieralisi , Mark Rutland , Sudeep Holla , Will Deacon , Jonathan Cameron , Suzuki K Poulose Subject: Re: [PATCH v4 2/2] coco: guest: arm64: Drop dummy RSI platform device stub In-Reply-To: <2026051352-albatross-contents-7113@gregkh> References: <20260427061615.905018-1-aneesh.kumar@kernel.org> <20260427061615.905018-3-aneesh.kumar@kernel.org> <2026051352-albatross-contents-7113@gregkh> Date: Wed, 13 May 2026 14:23:01 +0530 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Greg KH writes: > On Wed, May 13, 2026 at 12:28:12PM +0530, Aneesh Kumar K.V wrote: >> Catalin Marinas writes: >>=20 >> > + Suzuki again >> > >> > On Mon, Apr 27, 2026 at 11:46:15AM +0530, Aneesh Kumar K.V (Arm) wrote: >> >> The SMCCC firmware driver now creates the `arm-smccc` platform device >> >> and also creates the CCA auxiliary devices once the RSI ABI is >> >> discovered. This makes the arch-specific arm64_create_dummy_rsi_dev() >> >> helper redundant. Remove the arm-cca-dev platform device registration >> >> and let the SMCCC probe manage the RSI device. >> >>=20 >> >> systemd match on platform:arm-cca-dev for confidential vm detection [= 1]. >> >> Losing the platform device registration can break that. Keeping this >> >> removal in its own change makes it easy to revert if that regression >> >> blocks the rollout. >> >>=20 >> >> [1] https://lore.kernel.org/all/4a7d84b2-2ec4-4773-a2d5-7b63d5c683cf@= arm.com >> > >> > I wouldn't merge this now given that systemd checks this file. Could we >> > have a symbolic link instead for some time until systemd eventually ge= ts >> > updated (years?). >> > >>=20 >> I=E2=80=99ll add this in the next revision. >>=20 >> static int create_rsi_compat_link(struct device *target_dev) >> { >> struct kobject *platform_kobj; >> /* >> * target_dev is: >> * /sys/devices/platform/arm-smccc/arm_cca_guest.arm-rsi-dev.0 >> * Create compat link /sys/devices/platform/arm-cca-dev >> */ >> platform_kobj =3D target_dev->kobj.parent->parent; > > What? That is crazy, you don't know that is always going to be ok. > >> return sysfs_create_link(platform_kobj, >> &target_dev->kobj, >> "arm-cca-dev"); > > No, don't do that, if a driver calls a sysfs* function, something is > almost always wrong. Don't be making random sysfs symlinks please. > Sure, but could you explain why this is wrong? Below is the full version of the updated patch. coco: guest: arm64 Replace RSI platform device with compat symlink The SMCCC firmware driver now creates the arm-smccc platform device and registers the RSI device as an auxiliary device once the RSI ABI has been discovered. This makes the arch-specific arm64 arm-cca-dev platform device redundant. Remove the arm64 platform device stub and let the SMCCC core manage RSI device creation. This changes the real device location from the old platform device path to: /sys/devices/platform/arm-smccc/arm_cca_guest.arm-rsi-dev.0 Keep userspace compatibility by creating a sysfs symlink at the old path: /sys/devices/platform/arm-cca-dev A Debian Code Search check found systemd matching on the old platform:arm-cca-dev device path for confidential VM detection. No other userspace dependency on the old platform device path was found, but keeping the compatibility symlink avoids breaking existing systemd-based detection [1]. [1] https://lore.kernel.org/all/4a7d84b2-2ec4-4773-a2d5-7b63d5c683cf@arm.com Signed-off-by: Aneesh Kumar K.V (Arm) modified arch/arm64/kernel/rsi.c @@ -159,18 +159,3 @@ void __init arm64_rsi_init(void) =20 static_branch_enable(&rsi_present); } - -static struct platform_device rsi_dev =3D { - .name =3D "arm-cca-dev", - .id =3D PLATFORM_DEVID_NONE -}; - -static int __init arm64_create_dummy_rsi_dev(void) -{ - if (is_realm_world() && - platform_device_register(&rsi_dev)) - pr_err("failed to register rsi platform device\n"); - return 0; -} - -arch_initcall(arm64_create_dummy_rsi_dev) modified drivers/firmware/smccc/rmm.c @@ -4,13 +4,31 @@ */ =20 #include +#include +#include =20 #include "rmm.h" =20 +static int create_rsi_compat_link(struct device *target_dev) +{ + struct kobject *platform_kobj; + /* + * target_dev is: + * /sys/devices/platform/arm-smccc/arm_cca_guest.arm-rsi-dev.0 + * Create compat link /sys/devices/platform/arm-cca-dev + */ + platform_kobj =3D target_dev->kobj.parent->parent; + + return sysfs_create_link(platform_kobj, + &target_dev->kobj, + "arm-cca-dev"); +} + void __init register_rsi_device(struct platform_device *pdev) { unsigned long ret; unsigned long ver_lower, ver_higher; + struct auxiliary_device *adev; =20 if (arm_smccc_1_1_get_conduit() !=3D SMCCC_CONDUIT_SMC) return; @@ -19,6 +37,10 @@ void __init register_rsi_device(struct platform_device *= pdev) if (ret !=3D RSI_SUCCESS) return; =20 - __devm_auxiliary_device_create(&pdev->dev, - "arm_cca_guest", RSI_DEV_NAME, NULL, 0); + adev =3D __devm_auxiliary_device_create(&pdev->dev, + "arm_cca_guest", RSI_DEV_NAME, NULL, 0); + if (!adev) + return; + + create_rsi_compat_link(&adev->dev); } > > If userspace can not find the device anymore, that's fine, that's how > sysfs works, devices move around all the time. Especially platform > devices as those are almost always not supposed to be platform devices :) > > thanks, > > greg k-h -aneesh