From patchwork Fri Mar 29 21:54:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13611130 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 C5AD513CAAD for ; Fri, 29 Mar 2024 21:55:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711749303; cv=none; b=BUUdZaBMymIepct4lb5ptvVUepsG6XlN2GVUp1aJRgrMNf95UtFTM1G25u4bTAmibUQzbC7yMsAZa6wxlhRsEBLJO+U5+M6Vpix3O7YQ4dcSiVk2589pEd9A4v0iLPCvtbBtP23xNSW18pT6KYGlVZ+69Q/bJe/u45KC6IHNS2k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711749303; c=relaxed/simple; bh=+T3tl89Zdmezqit2RxPwGaXHZUmsaUWzxhlx+dYkF00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=umM3yj4/Vwdw3aeUzKO6zzon4X8TonSU7/IJnY5dBm7Aq53vJiW/k8OGvqhJD3nt0U6fZpXNtOyQsZERPVffUqwrrybalEUgWXLMq+PQlVlsLu0RWORAyrWzv4iX5yqqVB8CLy/kjFtJgVzzjlvV6rsPsfMzviAfFyBjA+Wa86E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rqKBY-0004gX-Kb; Fri, 29 Mar 2024 22:54:52 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rqKBX-009GMG-Eb; Fri, 29 Mar 2024 22:54:51 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rqKBX-00DTk2-1B; Fri, 29 Mar 2024 22:54:51 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Tom Lendacky , Dan Williams , Kuppuswamy Sathyanarayanan , "Borislav Petkov (AMD)" Cc: linux-kbuild@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH] virt: sev-guest: Mark driver struct with __refdata to prevent section mismatch Date: Fri, 29 Mar 2024 22:54:41 +0100 Message-ID: <4a81b0e87728a58904283e2d1f18f73abc69c2a1.1711748999.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2e3783106bf6bd9a7bdeb12b706378fb16316471.1711748999.git.u.kleine-koenig@pengutronix.de> References: <2e3783106bf6bd9a7bdeb12b706378fb16316471.1711748999.git.u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1683; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=+T3tl89Zdmezqit2RxPwGaXHZUmsaUWzxhlx+dYkF00=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBmBzikL16JNEqPrgXgFn/CojyKrl2S5zMT3Jjsh 72gE+uqWgmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZgc4pAAKCRCPgPtYfRL+ TmTSB/4z//bEimBztaqRKnlEIhDD+Xw8x+OOt+6lINgqo7RQLKyw5VWfk3wBb09BL4jioezwOFe U/KLZOvglOVpAiTr4VYmu31p2QR2gFJCnDnZnL0ky5Xix4q+0XIzvOwkv99r03brwb4Ptqlc3I/ Mj5WIh3G+OnJBfB9fy+thL+InCcLxDYUYmDLDElBD7EcLAP+yiyW3OnzY2pfTf6TAdPdL+AAInn D1vfFe4cRhyUj2gCDrghbFxuDThdS6JjQOhxnOdinuQm2SJLG0/erosWPaR9saYNEItPQEqWwqh 4D+l9gvqEeVnyr/ORgLOrud78Q3LBxndbVYcc86sN3mq92SN X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kbuild@vger.kernel.org As described in the added code comment, a reference to .exit.text is ok for drivers registered via module_platform_driver_probe(). Make this explicit to prevent the following section mismatch warning WARNING: modpost: drivers/virt/coco/sev-guest/sev-guest: section mismatch in reference: sev_guest_driver+0x10 (section: .data) -> sev_guest_remove (section: .exit.text) that triggers on an allmodconfig W=1 build. Signed-off-by: Uwe Kleine-König Reviewed-by: Kuppuswamy Sathyanarayanan Reviewed-by: Tom Lendacky --- drivers/virt/coco/sev-guest/sev-guest.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) base-commit: a6bd6c9333397f5a0e2667d4d82fef8c970108f2 diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c index 87f241825bc3..1af68065b3d9 100644 --- a/drivers/virt/coco/sev-guest/sev-guest.c +++ b/drivers/virt/coco/sev-guest/sev-guest.c @@ -1009,8 +1009,13 @@ static void __exit sev_guest_remove(struct platform_device *pdev) * This driver is meant to be a common SEV guest interface driver and to * support any SEV guest API. As such, even though it has been introduced * with the SEV-SNP support, it is named "sev-guest". + * + * sev_guest_remove() lives in .exit.text. For drivers registered via + * module_platform_driver_probe() this is ok because they cannot get unbound at + * runtime. So mark the driver struct with __refdata to prevent modpost + * triggering a section mismatch warning. */ -static struct platform_driver sev_guest_driver = { +static struct platform_driver sev_guest_driver __refdata = { .remove_new = __exit_p(sev_guest_remove), .driver = { .name = "sev-guest",