From nobody Sat Feb 7 04:40:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1646994899; cv=none; d=zohomail.com; s=zohoarc; b=e4VKrDgnaKgn4NJl7bRfsbdCm2h/Gtvs3FvafRvWapw+AYNI7+LAy//c4UBrfd2qPM6W8tQVLgSfV/pvOwLqhfvHOH0a6rJ1ovvkCQKt+u2zJahRj2urAf9w9gabkqwxjxcMhnrN0TF/kHl+2tp+DyTkbu04KW0tPPGUzUsZJgI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646994899; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zIKrcrVv8sT7uGpdxBONglT2SrtoCB1xadTjqU49EQU=; b=NGj3W8leDwlVDGkRm9YqN3YPF/AkFTsWHziYkdmt+ndW9aKBMOKWzru/HFzpnaJTK1VkDbaSXCs8lVdrR4pmDyllkyztAT686CFSYxMr2EEmxmDRuMirq9vCKLEjP6q111Npuu6X+sI/xrHqeeJpmXWND8Qx4Qsr3tjGk2ElbJ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1646994899523419.05436093353535; Fri, 11 Mar 2022 02:34:59 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.288917.490089 (Exim 4.92) (envelope-from ) id 1nScbU-0004B2-QJ; Fri, 11 Mar 2022 10:34:36 +0000 Received: by outflank-mailman (output) from mailman id 288917.490089; Fri, 11 Mar 2022 10:34:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nScbU-0004AF-Jx; Fri, 11 Mar 2022 10:34:36 +0000 Received: by outflank-mailman (input) for mailman id 288917; Fri, 11 Mar 2022 10:34:35 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nScbT-00047U-K8 for xen-devel@lists.xenproject.org; Fri, 11 Mar 2022 10:34:35 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d7973e09-a126-11ec-8eba-a37418f5ba1a; Fri, 11 Mar 2022 11:34:34 +0100 (CET) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A6E151F38D; Fri, 11 Mar 2022 10:34:33 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7E45213FA6; Fri, 11 Mar 2022 10:34:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id sBSlHbklK2LxdQAAMHmgww (envelope-from ); Fri, 11 Mar 2022 10:34:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d7973e09-a126-11ec-8eba-a37418f5ba1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1646994873; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zIKrcrVv8sT7uGpdxBONglT2SrtoCB1xadTjqU49EQU=; b=ELDyhB/pH3g1wNJ9NCIGljJ0NiUjr/eV44nW0TBeCBZEPxzRjH0TAZleF2TcInRM3GMZq5 bNyCjCx4Dprb3ou9V62DzSxf8GOTp6WpxPDTeucbqFJA2wZV0cbT+bvqNkLKnF8vFrPzz4 QEZNLWqGh6PdbE6DjGcNB4TU1l/RBK8= From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini Subject: [PATCH 1/2] xen/grant-table: remove gnttab_*transfer*() functions Date: Fri, 11 Mar 2022 11:34:28 +0100 Message-Id: <20220311103429.12845-2-jgross@suse.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220311103429.12845-1-jgross@suse.com> References: <20220311103429.12845-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1646994901079100005 Content-Type: text/plain; charset="utf-8" All grant table operations related to the "transfer" functionality are unused currently. There have been users in the old days of the "Xen-o-Linux" kernel, but those didn't make it upstream. So remove the "transfer" related functions. Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky --- drivers/xen/grant-table.c | 113 +------------------------------------- include/xen/grant_table.h | 8 --- 2 files changed, 2 insertions(+), 119 deletions(-) diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index 5c83d41766c8..8963af8ec764 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -109,7 +109,7 @@ struct gnttab_ops { void (*unmap_frames)(void); /* * Introducing a valid entry into the grant table, granting the frame of - * this grant entry to domain for accessing or transfering. Ref + * this grant entry to domain for accessing. Ref * parameter is reference of this introduced grant entry, domid is id of * granted domain, frame is the page frame to be granted, and flags is * status of the grant entry to be updated. @@ -125,14 +125,6 @@ struct gnttab_ops { * access for this entry and return success(=3D=3D1). */ int (*end_foreign_access_ref)(grant_ref_t ref, int readonly); - /* - * Stop granting a grant entry to domain for transfer. Ref parameter is - * reference of a grant entry whose grant transfer will be stopped. If - * tranfer has not started, just reclaim the grant entry and return - * failure(=3D=3D0). Otherwise, wait for the transfer to complete and then - * return the frame. - */ - unsigned long (*end_foreign_transfer_ref)(grant_ref_t ref); /* * Read the frame number related to a given grant reference. */ @@ -230,10 +222,7 @@ static void put_free_entry(grant_ref_t ref) * Following applies to gnttab_update_entry_v1 and gnttab_update_entry_v2. * Introducing a valid entry into the grant table: * 1. Write ent->domid. - * 2. Write ent->frame: - * GTF_permit_access: Frame to which access is permitted. - * GTF_accept_transfer: Pseudo-phys frame slot being filled by new - * frame, or zero if none. + * 2. Write ent->frame: Frame to which access is permitted. * 3. Write memory barrier (WMB). * 4. Write ent->flags, inc. valid type. */ @@ -455,102 +444,6 @@ void gnttab_end_foreign_access(grant_ref_t ref, int r= eadonly, } EXPORT_SYMBOL_GPL(gnttab_end_foreign_access); =20 -int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn) -{ - int ref; - - ref =3D get_free_entries(1); - if (unlikely(ref < 0)) - return -ENOSPC; - gnttab_grant_foreign_transfer_ref(ref, domid, pfn); - - return ref; -} -EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer); - -void gnttab_grant_foreign_transfer_ref(grant_ref_t ref, domid_t domid, - unsigned long pfn) -{ - gnttab_interface->update_entry(ref, domid, pfn, GTF_accept_transfer); -} -EXPORT_SYMBOL_GPL(gnttab_grant_foreign_transfer_ref); - -static unsigned long gnttab_end_foreign_transfer_ref_v1(grant_ref_t ref) -{ - unsigned long frame; - u16 flags; - u16 *pflags; - - pflags =3D &gnttab_shared.v1[ref].flags; - - /* - * If a transfer is not even yet started, try to reclaim the grant - * reference and return failure (=3D=3D 0). - */ - while (!((flags =3D *pflags) & GTF_transfer_committed)) { - if (sync_cmpxchg(pflags, flags, 0) =3D=3D flags) - return 0; - cpu_relax(); - } - - /* If a transfer is in progress then wait until it is completed. */ - while (!(flags & GTF_transfer_completed)) { - flags =3D *pflags; - cpu_relax(); - } - - rmb(); /* Read the frame number /after/ reading completion status. */ - frame =3D gnttab_shared.v1[ref].frame; - BUG_ON(frame =3D=3D 0); - - return frame; -} - -static unsigned long gnttab_end_foreign_transfer_ref_v2(grant_ref_t ref) -{ - unsigned long frame; - u16 flags; - u16 *pflags; - - pflags =3D &gnttab_shared.v2[ref].hdr.flags; - - /* - * If a transfer is not even yet started, try to reclaim the grant - * reference and return failure (=3D=3D 0). - */ - while (!((flags =3D *pflags) & GTF_transfer_committed)) { - if (sync_cmpxchg(pflags, flags, 0) =3D=3D flags) - return 0; - cpu_relax(); - } - - /* If a transfer is in progress then wait until it is completed. */ - while (!(flags & GTF_transfer_completed)) { - flags =3D *pflags; - cpu_relax(); - } - - rmb(); /* Read the frame number /after/ reading completion status. */ - frame =3D gnttab_shared.v2[ref].full_page.frame; - BUG_ON(frame =3D=3D 0); - - return frame; -} - -unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref) -{ - return gnttab_interface->end_foreign_transfer_ref(ref); -} -EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer_ref); - -unsigned long gnttab_end_foreign_transfer(grant_ref_t ref) -{ - unsigned long frame =3D gnttab_end_foreign_transfer_ref(ref); - put_free_entry(ref); - return frame; -} -EXPORT_SYMBOL_GPL(gnttab_end_foreign_transfer); - void gnttab_free_grant_reference(grant_ref_t ref) { put_free_entry(ref); @@ -1423,7 +1316,6 @@ static const struct gnttab_ops gnttab_v1_ops =3D { .unmap_frames =3D gnttab_unmap_frames_v1, .update_entry =3D gnttab_update_entry_v1, .end_foreign_access_ref =3D gnttab_end_foreign_access_ref_v1, - .end_foreign_transfer_ref =3D gnttab_end_foreign_transfer_ref_v1, .read_frame =3D gnttab_read_frame_v1, }; =20 @@ -1435,7 +1327,6 @@ static const struct gnttab_ops gnttab_v2_ops =3D { .unmap_frames =3D gnttab_unmap_frames_v2, .update_entry =3D gnttab_update_entry_v2, .end_foreign_access_ref =3D gnttab_end_foreign_access_ref_v2, - .end_foreign_transfer_ref =3D gnttab_end_foreign_transfer_ref_v2, .read_frame =3D gnttab_read_frame_v2, }; =20 diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h index c9fea9389ebe..9f9b1a297f0d 100644 --- a/include/xen/grant_table.h +++ b/include/xen/grant_table.h @@ -125,11 +125,6 @@ void gnttab_end_foreign_access(grant_ref_t ref, int re= adonly, */ int gnttab_try_end_foreign_access(grant_ref_t ref); =20 -int gnttab_grant_foreign_transfer(domid_t domid, unsigned long pfn); - -unsigned long gnttab_end_foreign_transfer_ref(grant_ref_t ref); -unsigned long gnttab_end_foreign_transfer(grant_ref_t ref); - /* * operations on reserved batches of grant references */ @@ -162,9 +157,6 @@ static inline void gnttab_page_grant_foreign_access_ref= _one( readonly); } =20 -void gnttab_grant_foreign_transfer_ref(grant_ref_t, domid_t domid, - unsigned long pfn); - static inline void gnttab_set_map_op(struct gnttab_map_grant_ref *map, phys_addr_t addr, uint32_t flags, grant_ref_t ref, domid_t domid) --=20 2.34.1