Message ID | 20230829231912.4091958-4-volodymyr_babchuk@epam.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show
Return-Path: <xen-devel-bounces@lists.xenproject.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0F22C83F19 for <xen-devel@archiver.kernel.org>; Tue, 29 Aug 2023 23:20:24 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.592508.925234 (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1qb804-0006ki-3h; Tue, 29 Aug 2023 23:19:56 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 592508.925234; Tue, 29 Aug 2023 23:19:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <xen-devel-bounces@lists.xenproject.org>) id 1qb804-0006kb-06; Tue, 29 Aug 2023 23:19:56 +0000 Received: by outflank-mailman (input) for mailman id 592508; Tue, 29 Aug 2023 23:19:55 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from <SRS0=Y18t=EO=epam.com=prvs=36058b40d2=volodymyr_babchuk@srs-se1.protection.inumbo.net>) id 1qb803-0006kQ-0T for xen-devel@lists.xenproject.org; Tue, 29 Aug 2023 23:19:55 +0000 Received: from mx0b-0039f301.pphosted.com (mx0b-0039f301.pphosted.com [148.163.137.242]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8d570ca5-46c2-11ee-9b0d-b553b5be7939; Wed, 30 Aug 2023 01:19:51 +0200 (CEST) Received: from pps.filterd (m0174682.ppops.net [127.0.0.1]) by mx0b-0039f301.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37TFMk9f021983; Tue, 29 Aug 2023 23:19:48 GMT Received: from eur05-db8-obe.outbound.protection.outlook.com (mail-db8eur05lp2108.outbound.protection.outlook.com [104.47.17.108]) by mx0b-0039f301.pphosted.com (PPS) with ESMTPS id 3ssdvpbm4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 23:19:47 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com (2603:10a6:803:31::18) by AM7PR03MB6371.eurprd03.prod.outlook.com (2603:10a6:20b:1b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Tue, 29 Aug 2023 23:19:43 +0000 Received: from VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895]) by VI1PR03MB3710.eurprd03.prod.outlook.com ([fe80::9d42:8444:f00d:7895%4]) with mapi id 15.20.6699.034; Tue, 29 Aug 2023 23:19:43 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion <xen-devel.lists.xenproject.org> List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xenproject.org> List-Help: <mailto:xen-devel-request@lists.xenproject.org?subject=help> List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=subscribe> Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" <xen-devel-bounces@lists.xenproject.org> X-Inumbo-ID: 8d570ca5-46c2-11ee-9b0d-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Yb8bctkTG9C4wzoqZGcx3fQI+wXfN/+KWBTmmJxhRIuZ3FdpPAlOmiJy2fDW7D9lBpYzbuCxhIMOAk6d5BvilBRaY/SqtejXPoBBJprm2nvpznvi8RO4bIn+KMAC+qJrh49Q9w9FWF0yCEUZw9nSSMAOzRe+8N4B/xqv7WFXpTwyCPYeFNR4F/+dXASebDvBmCSPi/mBhPw1xbk9jX1rus0ZUsfgei3XwzdiDwSs9/sUcQ/EENbOiRL/mC5+6+b4FiBaE5uJ2DGyWQDC7uq1Q7vjn2Qf7auqFaRdk22IgoceP89jFL98zXQTZffexwnzS2j7QK0ACP1mUArJ1qFN2w== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u1exkS/uweIgKXeUpBvInyadEJMzoYayUA8BpUFSFtw=; b=iberMZOBsXwU5e/SktgmXy6EbrCeDNwLmSYhzfp+GgT3yKZWtQTu6db9clo10ldpNCP0qjNn+9PXUhKMvyEERDEHthSNK2ZTpUrLOX16IuDxDyMdIO1l+ynKEAzbklVn+PVSJHHdAY2W3bd3cdVzKt/QMpYHs5qNOj0vF5kvLO/JeJ7MMJSM+JMxGaTXeihJ6w0mz6dvz+1OIqFzF7wGdWzQGAXsl2fhLzFX0aUlU73rPqfPsv3Wd4FF6uQdiDMovluUICbUFIWqOlTvviwj1hQxaBIEcnicOXcktTulijxcjmeEO6C2ggXMg6iTEm/KpraXi4Bk8VoUPhSkg38sLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u1exkS/uweIgKXeUpBvInyadEJMzoYayUA8BpUFSFtw=; b=LdIXVIEuPdohj4F/EpfidYzR6m1UWIkmFljEkD0WmvPqDivdYXE5wQh0EDDbGVbpNzB4wuFLh2D9kokeqygkBqgT/cHUnybONT2PM0fKMjseeLAL6jLYox3A5/nXH+RWcD3UAb3bSOLdIQSpmMxgnJ/QignQMiKDqJL0aoOPVxKfrau+uuBG0HKymMsu5Csan8ZM92XFyQFgPYRCqRKjufPAinH/hJhtlBdnqPZuluDCvupWjYJo8K/oQmjVJnV7gmCaNo67J3ZfraVsC/VuztsK1K6DkSSCzeh4M3O//AgC59WBsM4RjfD7KmD1AuJUWn5fljRJ3yaeZ53Qiaqz5A== From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com> To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org> CC: Stewart Hildebrand <stewart.hildebrand@amd.com>, Oleksandr Andrushchenko <Oleksandr_Andrushchenko@epam.com>, =?utf-8?q?Roger?= =?utf-8?q?_Pau_Monn=C3=A9?= <roger.pau@citrix.com> Subject: [PATCH v9 03/16] vpci: restrict unhandled read/write operations for guests Thread-Topic: [PATCH v9 03/16] vpci: restrict unhandled read/write operations for guests Thread-Index: AQHZ2s9K3uXHQsaiPESKImIi9IiKlw== Date: Tue, 29 Aug 2023 23:19:42 +0000 Message-ID: <20230829231912.4091958-4-volodymyr_babchuk@epam.com> References: <20230829231912.4091958-1-volodymyr_babchuk@epam.com> In-Reply-To: <20230829231912.4091958-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.41.0 x-ms-publictraffictype: Email x-ms-traffictypediagnostic: VI1PR03MB3710:EE_|AM7PR03MB6371:EE_ x-ms-office365-filtering-correlation-id: 3f6a034c-0eed-42d7-ee2a-08dba8e66d99 x-ld-processed: b41b72d0-4e9f-4c26-8a69-f949f367c91d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: WxIQjI0a68yrnUfjB039J8OX5mdq6t9zWgtZQQs0+EylFXk0E7ALFlTKMnUt9rynIrt8UfpqSWj9OCAPEFSDmwuoBc+afygSTSKaK7AraR5DrCql9ZfineZRW4a2Lo17RR4i0+mRGqFPvUqVaCYd9q6TNfNpE8jOpkoMG4HThBE3k2gywICJcgEoA5Deb1EhN/l8M6i/JYtHOaKkg20Vb29eB/LY7JPqx3eAVTRek9x0BXIsiPJpFUnLD9Y5g2+zMSobWHn8Sw7LzP4Wfa8Fo6urI951yPGr9ao1Qv9thf5ojSp0nlv4h+0LqFcdkf+5GkH47aWJzcFWr7HpNJNjmnVBhRmIsBULmFRj+JfJFCg98jjOQNHCJze4InVjYaZPLtj0W4kM5ptc4XlpxoCMtXghEpeoelRPD9xdOEtJ3fJSic8OGJEqitquyXNxzqST6AnC1mzofsinXVGke/fQ1ghBhuBsQvrGLwQ5tniWfqMPm7jrpSQjW9LYYr65Ae4l9ecHRrIOpcSaeLYadAdYGxGsV4b72yRTW8IRLhqFuELGtShV/zLTHdzM0a5cf0TCOr9XSgjizVLe1b2JPdrsscy89FuVqa7SPHn8IorgNWr5nX6G6r5J7xAV/8SibqzJ x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR03MB3710.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(376002)(396003)(136003)(366004)(451199024)(1800799009)(186009)(71200400001)(6512007)(6506007)(6486002)(478600001)(55236004)(76116006)(1076003)(2616005)(26005)(2906002)(6916009)(64756008)(66446008)(54906003)(316002)(5660300002)(66476007)(66556008)(91956017)(66946007)(41300700001)(83380400001)(8936002)(4326008)(8676002)(36756003)(38070700005)(38100700002)(86362001)(122000001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q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Y23bSubD3ngdscuf1Z?= =?utf-8?q?rsljK9i8W/cFONDauS6nwFV1bbKPpEHmohwxan3KifemwNCEAU5R7qXUviVoy2hjO?= =?utf-8?q?r+Qp0hBob0NOwG8QMqWBROCQ3iShYB34wAru0x0YgNQ7svwXk2CMpyTeOXxHSdN1U?= =?utf-8?q?yv6ltGJ2/JpO7PyqmlsIq4o4hVV69N6g+lMh09BJhS98gUltOAUa5mW8/ICJjJkn3?= =?utf-8?q?e7MEULJds471Xk2Wd+h/l9zwHZoqa+aPLBqQyFdoKQ0wgY9ghaAvnAvT20OhXXr98?= =?utf-8?q?5ftXN1LdDoG6zzNRMM1q+tpG8UnIU7ST12AlSugqwTBLeKam8JexreHM/Xf81XAWv?= =?utf-8?q?Rq3ewRWPxOh+L6RzYMPPSkn762tRiCjblyvcPterS44Eyema8wslAERkgnt/LYBSN?= =?utf-8?q?1XmAAB78W0R67BHRBc2ZHheoaC+l4KA3D9fyKqw3yWsKbH7Zm5d0BFiRSELYs6eZT?= =?utf-8?q?rAoVq+iYHhDJG8URjOHZureFFM1RrvaQR8Qz5coyR0mlbGNEi5BRAY9hGojShWFcU?= =?utf-8?q?7bv56wPS2IHPYxRqcddPkHH5pHh1usubWTaBgVsIJIPMhJU44fzEDwWULNRlwFm48?= =?utf-8?q?76xjzTTVJ7sMoYkNCXHklFY9fipINQHNMiNdF6ixVx9fOJF9Er1qwQekne5ay0qGo?= =?utf-8?q?OsaiFg3sLK6nvTa+R50I/PxRtDGB/lZ2fg=3D=3D?= Content-Type: text/plain; charset="utf-8" Content-ID: <13D18B520035FB468CB752BA33A6723A@eurprd03.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3710.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f6a034c-0eed-42d7-ee2a-08dba8e66d99 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Aug 2023 23:19:42.8503 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vRtRiv9Nf+xw0DSm16Nkle+MfmvvAE8nMhVtKiCBsm4J5bz4B987p4hUc0tkYeebI9UOdNpwfckiK3tI09ATupeaJJziSAXyq2w8rvXRJfM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR03MB6371 X-Proofpoint-ORIG-GUID: at9ngLsWyGyG-BiUSJp1Xd_7n9ZHX1Dy X-Proofpoint-GUID: at9ngLsWyGyG-BiUSJp1Xd_7n9ZHX1Dy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_16,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 mlxscore=0 adultscore=0 priorityscore=1501 impostorscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 suspectscore=0 mlxlogscore=999 clxscore=1011 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290202 |
Series |
PCI devices passthrough on Arm, part 3
|
expand
|
diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c index 34fff2ef2d..cb45904114 100644 --- a/xen/drivers/vpci/vpci.c +++ b/xen/drivers/vpci/vpci.c @@ -233,6 +233,10 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned int reg, { uint32_t data; + /* Guest domains are not allowed to read real hardware. */ + if ( !is_hardware_domain(current->domain) ) + return ~(uint32_t)0; + switch ( size ) { case 4: @@ -276,6 +280,10 @@ static uint32_t vpci_read_hw(pci_sbdf_t sbdf, unsigned int reg, static void vpci_write_hw(pci_sbdf_t sbdf, unsigned int reg, unsigned int size, uint32_t data) { + /* Guest domains are not allowed to write real hardware. */ + if ( !is_hardware_domain(current->domain) ) + return; + switch ( size ) { case 4: