From nobody Mon Apr 13 05:39:40 2026 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C1AF169AD2 for ; Mon, 9 Mar 2026 08:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773045436; cv=none; b=RN/hRFSlgo3v3Seb8G4AWWOvlPRVq5wgnGzZ23HMcOicxGpsvsvbGaCYlCMCKjsktWwgF9I/JVV8yDSHmHarUCRxsU48CqHDlencW5qp6emY7c7hIpJOISarfzxWziBhgp6lMplnr49i+snRzAaDTkssUalhLSEOMGNJWKVLG+U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773045436; c=relaxed/simple; bh=gMb+G19OtT8pfA2CDx/6IQ4DQN+95hybQm2T8sr5MoI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=YUdhlFFFFEbaHhDKJHCgVZ2yuUw6c61GFPt3FnTsAoahu5lcSG54D9XBfakzL7/55a7IKJBn0+SsLv6gjwWLWVuHEbBDyWOzeAtPjpMRrgNJdjjmw0ZvUV0vLflRqhQ0qjHsse9gp0DjV+gpXDPPfkHLgducje8uFjOmsZyQbiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=isrc.iscas.ac.cn; spf=pass smtp.mailfrom=isrc.iscas.ac.cn; arc=none smtp.client-ip=159.226.251.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=isrc.iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=isrc.iscas.ac.cn Received: from localhost.localdomain (unknown [210.73.43.101]) by APP-05 (Coremail) with SMTP id zQCowABX7A+yhq5pUEjxCQ--.52456S2; Mon, 09 Mar 2026 16:37:06 +0800 (CST) From: Pengpeng Hou To: jgross@suse.com, sstabellini@kernel.org, oleksandr_tyshchenko@epam.com Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, 18291782795@163.com, pengpeng.hou@isrc.iscas.ac.cn Subject: [PATCH] xen/grant-table: scope gnttab suspend and resume helpers to hibernate callbacks Date: Mon, 9 Mar 2026 08:36:22 +0000 Message-Id: <20260309083622.717803-1-pengpeng.hou@isrc.iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: zQCowABX7A+yhq5pUEjxCQ--.52456S2 X-Coremail-Antispam: 1UD129KBjvJXoW7AFyfCFW7Wr4UCw1UKF1xKrg_yoW8Xw1fpF WDJrWjyrZ8Ga4SvFWSya4FyFy5Ca9xJayxJrs8urZxZa1xGF1xArWSqFy0vrn7GrW8JF4v yFsFg343Cr4UZFUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1j6r1xM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Jr0_Gr1l84ACjcxK6I8E87Iv6xkF7I0E14v26r4j6r 4UJwAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY1x0262kKe7AKxVWU AVWUtwCY02Avz4vE14v_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr 1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE 14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7 IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E 87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73Uj IFyTuYvjfU8wIDDUUUU X-CM-SenderInfo: pshqw1hhqjhx1rx6x21ufox2xfdvhtffof0/ Content-Type: text/plain; charset="utf-8" From: pengpeng.hou@isrc.iscas.ac.cn In current linux.git (1954c4f01220), gnttab_suspend() and gnttab_resume() are defined and declared unconditionally. However, their only in-tree callers reside in drivers/xen/manage.c, which are guarded by #ifdef CONFIG_HIBERNATE_CALLBACKS. Match the helper scope to their callers by wrapping the definitions in CONFIG_HIBERNATE_CALLBACKS and providing no-op stubs in the header. This fixes the config-scope mismatch and reduces the code footprint when hibernation callbacks are disabled. Signed-off-by: pengpeng.hou@isrc.iscas.ac.cn --- diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -int gnttab_resume(void) +#ifdef CONFIG_HIBERNATE_CALLBACKS +int gnttab_resume(void) { gnttab_request_version(); return gnttab_setup(); @@ if (xen_pv_domain()) gnttab_interface->unmap_frames(); return 0; } +#endif =20 static int gnttab_expand(unsigned int req_entries) { diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ =20 int gnttab_init(void); +#ifdef CONFIG_HIBERNATE_CALLBACKS int gnttab_suspend(void); int gnttab_resume(void); +#else +static inline int gnttab_suspend(void) +{ + return 0; +} + +static inline int gnttab_resume(void) +{ + return 0; +} +#endif =20 int gnttab_grant_foreign_access(domid_t domid, unsigned long frame, int readonly);