From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85FB2C433F5 for ; Mon, 13 Sep 2021 07:28:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6BB596103B for ; Mon, 13 Sep 2021 07:28:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237655AbhIMHaD (ORCPT ); Mon, 13 Sep 2021 03:30:03 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.111.102]:26451 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237587AbhIMHaA (ORCPT ); Mon, 13 Sep 2021 03:30:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631518123; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hwD0t7QtOjKdwm4YKCqr7HJsRnUZs/jS/v3G2iEWAa8=; b=UOSwvnFtCQpvKiQf+q4PRphDdsxizTls0/lrDLUpLqgKjadi/o+E0SQFXnBYwQt9CcoiZr /FsnNhNPZ8WnXq4bLhN2ENfqCucL7gQ2Zpp7zeC2A5BjifsyoiMfJTuMwp5poxU8j/u0F0 MReNolaf+6GdH//QlfgTD4UMRJsHiNo= Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04lp2053.outbound.protection.outlook.com [104.47.14.53]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-26-EFU8yxbEMSi1f0NA_H9_Wg-1; Mon, 13 Sep 2021 09:28:42 +0200 X-MC-Unique: EFU8yxbEMSi1f0NA_H9_Wg-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HetmQA6G6KQc0Ars8sFJcEgeKzVb+mUw4CCId6XhJzXN4XWw3LyXFEGzISJoIPM3yG7Fz8mPRmA5RAziqWKKtYWMK6z3czxj+5PNJ0bxax+3yDorLrhNETR9oh/ITNgolQuXxgemKrfabs7jeC99f4VJjwATHSHYY1KBXpcfmgYD0tqrXAGD+rwGioNnIgy3QgTU4ir87LDovPLVsG4d1wc3tBWSkR5FDyCOWzmZaU2DY/lHDyWRGCX1lRGIP/RC+AJZkc0PGKxPb7bU9k/QZUI3ERFOi/phZt5LBjTG7DOBc0TaHqovNxuV8dPLBhCveRMnPRY9gV/7M868B6Hr+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hwD0t7QtOjKdwm4YKCqr7HJsRnUZs/jS/v3G2iEWAa8=; b=OtQ9DRXvc5RNt1cf3iwJUrakR6XcLKtgHOR5bDSDkmid+QylMRZ+CE/lhH0YR+uMAYQKUqo2fGYEfZKsVzyVxCVrpwFoka9X8iMWowSIPtU4rcG94R9+kNFMkyRukOwDxIjX2gwijmxsI5OzK3ihnxPHcAw0IzivkXHwySs6D0y46dwkNIryxeDuDNjSdF4zvZDYnEFbivDcdxB10X5JoI7vW4VTKg5oVyEhqXecqhdfUGItKXlbUDhHxvLnohCH9hAPl1oBJu0V/7i4IPr5AfNgrjl1G4fXDQi0HhJ52LSOzoRf4FBoWJNsUGyXku08AaMKW3oFV6IxsEhiWh4hjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: infradead.org; dkim=none (message not signed) header.d=none;infradead.org; dmarc=none action=none header.from=suse.com; Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB5599.eurprd04.prod.outlook.com (2603:10a6:803:de::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.16; Mon, 13 Sep 2021 07:28:41 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4500.018; Mon, 13 Sep 2021 07:28:41 +0000 Subject: Re: [PATCH 12/12] swiotlb-xen: this is PV-only on x86 To: Stefano Stabellini Cc: Juergen Gross , Boris Ostrovsky , lkml , "xen-devel@lists.xenproject.org" , the arch/x86 maintainers , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Christoph Hellwig References: <588b3e6d-2682-160c-468e-44ca4867a570@suse.com> <004feaef-f3bb-e4bb-fb10-f205a9f69f28@suse.com> From: Jan Beulich Message-ID: <543b446b-0143-ad32-99ed-d7a6f79381e8@suse.com> Date: Mon, 13 Sep 2021 09:28:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AM0PR01CA0102.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::43) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.156.60.236] (37.24.206.209) by AM0PR01CA0102.eurprd01.prod.exchangelabs.com (2603:10a6:208:10e::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4500.14 via Frontend Transport; Mon, 13 Sep 2021 07:28:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a77e551-9d0a-4196-c346-08d976881c14 X-MS-TrafficTypeDiagnostic: VI1PR04MB5599: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 06ci2HYkNPNKQake3kequ1jcFFCnILJfHXoHuBTf+qVOu6eE46Iaz4Szw9KZwOZM12VQbsAPAFKdwTNymu4pn7q8S9el7HdpMKwJjABSv3sku9iCALROdg1r6ryI4ocBDbqN2UhdIAUyEJfgow3DtisPvrVyFlNos7RpGscsqn+aPzzvfHSlZQwc8QRbmduQJoWKWXnd5DVEb5wnNXya8yLdHOUkxQSBMajhjZwe3/pshjDnN6WFv0zcvHbeaIRe1GXUM9BFAfA0w6b1/tNLi4Qe7AIZk29fZzOfPmvgAe5tagb99qg5UYs2/no7vWCLVTlvhcQUIvACPUkGRkAa0c7aWdzpXrEnr2+QgKHgxI1SewdN+tq23UPuaJ1WZv1ZdSUqlz5M4MWnuCTlBB2+bNDaKH7UMsYMbasgC3TipqmQDDJlMQ4R2RAJiPqGRHgXK6j5jguYcIdgNP2PWGSnIJ8FMZ8KJYXbPf4pbPeLqDPwIVGg8ZLzy4igIUR5zpT1LT03ZTbmN0YISaem+xZ0m/a/cK0LG90dyYgYCx4QJxUx3kMAQ7pzupi1sPsZwiJh6RfMwsJN4qE/yvNJgd0VD35f67M3vXZMzstag7YhL6/y0AjANDkXj8RJ+x+v37M8B0HAPsbGDnxJRc8Hrla6dcQR0OnRmXEeUdGLwmFbDrZBQWXlgDFY4DKylviIpVICVvfygdk48uYxEXxPwe5jnQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(136003)(39860400002)(346002)(376002)(366004)(396003)(66946007)(66476007)(66556008)(5660300002)(86362001)(38100700002)(2906002)(36756003)(31696002)(8676002)(4326008)(83380400001)(2616005)(53546011)(8936002)(16576012)(478600001)(6486002)(956004)(54906003)(31686004)(316002)(186003)(6916009)(26005)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dVhDY1JTaVowYnBCM2I3QVMxTnRGZFhrbzByMFBPQUkrWFZ1U0d3bUhTR2VO?= =?utf-8?B?bU5XRWg5NHRDam1aWlkyek9uOGtQTUdLK2hhSnVIQWlTVkJOb09GM0dDZXRx?= =?utf-8?B?RkxEd3RZVTY2ME43UFpleGQyRzBBSUNhSEdZMkFIZzlqbFZUVDhvTUoxdWd1?= =?utf-8?B?SmRkTmdIR0xmS1dQQnlNazJSTU5aVFA5VzdNRUMrc2s2dXRzbGV5V2ZmWXZy?= =?utf-8?B?RmU5VHpHWmdvYW1PUVdQem0xSFNRTTdLQk1tT0tTemhpa29aYmZZbGNIbi9n?= =?utf-8?B?Y2xWOVVHeXUwTWFsMDA5eTUrSERzKzltQVJRNnJrT2J3TEFjQTlHcmNUQm1F?= =?utf-8?B?ZWtZc2lHR0U5b3F6WitNdWVTeVR2NFlOMFhhNFdGN2VRTlAzanlmZzNWZ3o4?= =?utf-8?B?RklnMk4weVU3VWhBY3BMck5KdkliNXFKVERBUjRXUW5ZZ3JpMkxlT2kzWnJz?= =?utf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nYWJzdjMy?= =?utf-8?B?OUY5SERhR1RKVjIwelAvdFJyc1owN01yYUttNm85S2NlbGJ4blY0b0FEMFhZ?= =?utf-8?B?NnNzTFF2WkE3SUNHa1RWNFV1TC95N0pYOGdrOHVBTnVWWHZESkFhMFVjdjBQ?= =?utf-8?B?ajZxdWZCWTE0ekZtUDVUV2pTY1NEa2tGL09ja2QzK29OS0V6YWpqem0vWlVL?= =?utf-8?B?dWIrZU1VK2owZ0ZLSmVSMnhFRjhPNkV2NmVzU2dvU05xZEhTTHdUUzRQWW84?= =?utf-8?B?SDB0bnVBZUJoN3I2cHBLVHRCSmVFUnl2RnBjdy9JcEZmaUtYU0k4VXlGZ2dT?= =?utf-8?B?aitGUFFpci9sbGtSLzArNmVQZ3Q4eE8rVFRoVGxkZWJ0WUNMSzFDNXNTTnda?= =?utf-8?Q?g1NDQ/KngzTxu7Qd0+JQk6MpH2NCKMRhohC37RI?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a77e551-9d0a-4196-c346-08d976881c14 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2021 07:28:40.9527 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qNLKJHn3NU9hMMJ4NQW5/dX7cJzl339+gCX5Y3XuF/IUJSmWkfmGVXJwh9rkBsHQaEvVayZq2cv4uMOz+6Cosg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5599 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.09.2021 01:48, Stefano Stabellini wrote: > On Wed, 8 Sep 2021, Christoph Hellwig wrote: >> On Tue, Sep 07, 2021 at 02:13:21PM +0200, Jan Beulich wrote: >>> The code is unreachable for HVM or PVH, and it also makes little sense >>> in auto-translated environments. On Arm, with >>> xen_{create,destroy}_contiguous_region() both being stubs, I have a hard >>> time seeing what good the Xen specific variant does - the generic one >>> ought to be fine for all purposes there. Still Arm code explicitly >>> references symbols here, so the code will continue to be included there. >> >> Can the Xen/arm folks look into that? Getting ARM out of using >> swiotlb-xen would be a huge step forward cleaning up some DMA APIs. > > On ARM swiotlb-xen is used for a different purpose compared to x86. > > Many ARM SoCs still don't have an IOMMU covering all DMA-mastering > devices (e.g. Raspberry Pi 4). As a consequence we map Dom0 1:1 (guest > physical == physical address). > > Now if it was just for Dom0, thanks to the 1:1 mapping, we wouldn't need > swiotlb-xen. But when we start using PV drivers to share the network or > disk between Dom0 and DomU we are going to get DomU pages mapped in > Dom0, we call them "foreign pages". They are not mapped 1:1. It can > happen that one of these foreign pages are used for DMA operations > (e.g. related to the NIC). swiotlb-xen is used to detect these > situations and translate the guest physical address to physical address > of foreign pages appropriately. Hmm, you say "translate", which isn't my understanding of swiotlb's purpose. As per my understanding swiotlb instead double buffers data such that is becomes accessible, or suitably arranges underlying machine addresses. The latter part is clearly a PV-only thing, unused by Arm as can be seen by there not being any use of XENMEM_exchange. So it must be the former part that you're talking about, but that's also the purpose of the non-Xen swiotlb code. If only for my own education and understanding, could you point me at the difference between swiotlb-xen and generic swiotlb which addresses this specific aspect of Arm behavior? Jan