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=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 A7997C433F5 for ; Mon, 13 Sep 2021 07:51:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8721961004 for ; Mon, 13 Sep 2021 07:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237784AbhIMHwX (ORCPT ); Mon, 13 Sep 2021 03:52:23 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.111.102]:47674 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237653AbhIMHwW (ORCPT ); Mon, 13 Sep 2021 03:52:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631519466; 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=pr9NsquezdntMofNXZDBaoS0vQXjzZVpzsSAdnW8nHY=; b=GPS4mIjkpNXl2cG8KJDawjNSxuffZVT7yIp9I5CqV/6onw/+CuTxV0uI/MIh0MJl8Epq+M 67AKkeCTesiQ3xUyMN1URHtM6e6uM7GB+qEW83GqUXRlnxCaSNx5jzrKZRcmnqnr0g1TaR 4k5QPNLV5hR+lJ6sMalLVYp7LktJpyo= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2170.outbound.protection.outlook.com [104.47.17.170]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-16-tUFgrveFND-f5Uh5aIyxrg-2; Mon, 13 Sep 2021 09:51:05 +0200 X-MC-Unique: tUFgrveFND-f5Uh5aIyxrg-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1bb3SPEaSiGZXT90apSKba+yGZHwzQ3H6XtkXaaRYppbCwlOxn+TFQCHjYTgtBNsDYdqEBDluIXP3PjRzNFYhw4gbURqaJi+MKfVD1b5m1pyFrcL04hZxB6dRk9m2r33zQxRbLGQr8W7HFeD0xlV6qO2fjux82If7Urybzm18k0CCIkn2eFYaeApPDY+qv2OLifinUrW/tpxYvuvU8EAFYss7zBTvy6lUmNieoBBgDTC3ifu7gmrBBAgz4BFyqP3Xn0FXXwKW2Wyibmb+DrdqzR1xgK/l2X1adfii6+Rz6f2eboa4Ckc05Gi/whzOUzwXAlfhMuM6UKffawLDSDZw== 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=pr9NsquezdntMofNXZDBaoS0vQXjzZVpzsSAdnW8nHY=; b=VyzSpuFavPXiofaPaQTAm2I0AYATwVHcfIk024mlV44lOH3iOiz5gOAUE2KZCRYF/tljyI7aF7vXmWdzdq+v5z83Bzw+4B75wVKNNaq9bo8dCmQ6swez/UGJeklZFMsorKHHHcIVh6hI1eve1fXhS1b7QScK9XM4p6lWOHT/E4ZiCV70kQQVpp+oAKYb01V6tkwwBmoxdzgs8U4+xzzGVFjtbogiSFL7juDyGUFrJQFG7Qrx+1e2s0tNvwjcD8JUjPnYBgQlCVEqA5AfzRuAEzd3GKzC6GaD0S4uAKFfDnSZ6vJvmQlK70sl2ypIC9pJivu3t0lwpaflIMAy1BuDlA== 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 VI1PR04MB7150.eurprd04.prod.outlook.com (2603:10a6:800:12a::17) 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:51:03 +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:51:02 +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: Date: Mon, 13 Sep 2021 09:51:01 +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: FR0P281CA0071.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::10) 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 FR0P281CA0071.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.9 via Frontend Transport; Mon, 13 Sep 2021 07:51:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 762ff284-8c96-4fae-4f5b-08d9768b3be9 X-MS-TrafficTypeDiagnostic: VI1PR04MB7150: 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: b+2yabJw7c8ZF+8rLpJfPrxAoSQW7hCpXduq8D3xkfHTG0kS0Vg+W4DxWdjKx8PlAX0CrsQAvk/GJSPwFlik8jJxDsQkfdyEOXZfJuEKEpF2t3ZQyqO05K3T07mxCHDYvUbcvwPjnnUUAOwRXr75mx0tJcw3DLxowPCtAsUJPPFaowoDvv4ORzybh/6jMXCpUcPA9A9pGtANJednsfKm1twYJA4teXDlj0Iaa9XLacmE41e5TUj9b0cy/jiqFUqurZwro71NMBUluRVSgY9weUsgD09YjWQKOAs/T57ioDuQ2zVGnQUGtxDGixWrHn7vSx9mMjN9YtGXDIJXiLLrbF12GJhbgSv3TbIZCnsiMiO1v/RjZm5veFcgT4a4gD4+xAl8zpLMa3MT6n9i3kxzGKyWQBM5jqTT+hhwzA50korrfeRYVABPGplqWUvp0OBLzpOfIAUS2mtzLI8jfpjmhULnPrxB0SKe5C0WZyhO+lRk6Jesc4aPXff5bmKk53fFLr1euJ8i0ooSc1xu0LMkJuBvOT8q+M3jVzTNYyluI4NG10OCuTnO74WjfILuAFCrjO3ZYks1u/Ud5nMXbqXIHIU1kRT90qPSnREWI57/Ty59+xUElq8PB6f6XDA3WKlskce0GvoYpS23II+Ud+YbLGy6RI4FnNWBKASaCaIM3KDmwKA9OXWXE3DgmzEVc/sLmfE/g6XO/eiYusRSUQtePEaoZUw9XIfU619+RB2V1ouNauPm534S5w45rxVoRstE 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:(366004)(136003)(346002)(39860400002)(376002)(396003)(8676002)(6916009)(66476007)(31696002)(86362001)(66556008)(186003)(38100700002)(478600001)(83380400001)(16576012)(36756003)(2616005)(316002)(26005)(53546011)(31686004)(8936002)(4326008)(54906003)(5660300002)(2906002)(66946007)(956004)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Rno4YldhTnFxd0RpV2E3TDNqSnlDMWFEMitlb1dYQUdyVHp2elRhVzRSeEZM?= =?utf-8?B?ejNMa2E5d085UGNwVDVIVDdrN1VzdStndWlzZ0lBOVc0enRBWlZFcndaQTNJ?= =?utf-8?B?NFd4VzFNSHFocmd4YVZlYjg1NWZJbjNRVnZYVE9DbUVIVVBFK0hvZlBQYytr?= =?utf-8?B?Vjh0UDV0MDNnNCtHeXBkVFZURUtBVkFSMXROK0lJb2dpTlVhclFMeUxBREw5?= =?utf-8?B?QUlVekJ4bnYxMzNJNHZka00vUjVjYzM5QVAvVlJSOFNOUWh0dGFmMWw1ZzZo?= =?utf-8?B?ZURiemhleVJFZ24vWDhpTTVmbzNuejhDK3BFdVdaTzkyNDQySzNBallQdTMr?= =?utf-8?B?N0dxTFVjS205bnBxYTFSeW1VV3owV01JY1NOTE8xV2dBMkhKeGtEeWdOSUNF?= =?utf-8?B?Y3grYVRScXVNcFZYbHhwSFhrOS81MERJODA1alRsVHhVOStoNGhRcGlmdVh3?=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xL3Ur?= =?utf-8?B?OG5Yd0JZTTNCM1BpbHNkdm5QZkRtemRCOXE1TytCUllsM3ozMU43S1R1dVJ3?= =?utf-8?B?dDJpQ0MzdlFSeFNpNzRVK1hrK1dTTEJFdVYybFc5RjFVRUVOWEpDNjFrbmla?= =?utf-8?B?R3RSRzF2MXdhSnBvMFRRUVVTS1BZR0tULzZxSjlvSGp1c1E0L1FVRGZJcUNz?= =?utf-8?B?TjJZTkRvcS83ak9xVmo4dmMyTGx4d1hDYXdubjNpdGZCb0orZWFZcEdlZ0VF?= =?utf-8?B?RmErYkF6ZGR6V3plS1MwSzNmWCtsWjFrZHIzUXlkZWtQbGFPSE9YUXBTRFB5?= =?utf-8?B?MXVhb3V5OEowNXFqaFJkMWtvaXJMMlkwYnpWZE05K0grd1d2dURrUlNxQkQ1?= =?utf-8?Q?3IAHzROaXVsaqw1M9hZ7yKSOzskEBd30wJc6e8E?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 762ff284-8c96-4fae-4f5b-08d9768b3be9 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:51:02.8362 (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: M95ReYbmDRFLD9uHvKcfF6HUVD4FKx1m0TyUAS1zPv5row9eF3rfID8qrUFRe7yEoNJtUInFFbi64SL76l7Gig== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7150 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. Thinking about this some more - if Dom0 is 1:1 mapped, why don't you map foreign pages 1:1 as well then? >>> Instead of making PCI_XEN's "select" conditional, simply drop it - >>> SWIOTLB_XEN will be available unconditionally in the PV case anyway, and >>> is - as explained above - dead code in non-PV environments. >>> >>> This in turn allows dropping the stubs for >>> xen_{create,destroy}_contiguous_region(), the former of which was broken >>> anyway - it failed to set the DMA handle output. >> >> Looks good: >> >> Reviewed-by: Christoph Hellwig > > Reviewed-by: Stefano Stabellini Thanks for this and the other reviews. Jan