Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp254692rdb; Thu, 18 Jan 2024 02:33:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZLbrIc3spomD7uihdT0oxnRewUcjSzdndWSPEi8FU1JxhvZVnoHKrEP8A2SaFLtYW1UUJ X-Received: by 2002:a05:6214:c82:b0:681:87dc:c810 with SMTP id r2-20020a0562140c8200b0068187dcc810mr503901qvr.43.1705574035394; Thu, 18 Jan 2024 02:33:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705574035; cv=pass; d=google.com; s=arc-20160816; b=SyJI4exYbLu1RaPf3DGRoGkG4vgsj+ZFE5hLk4X0Utzz6I6pbNieNoNrb8MLUjGwnV C9VNEwA6noK5BatTPWLpSoWRr97GM9YISFwsLk0Okt12ImrEGmPrs6Wb3McL+t+x2+Df 5uWnujuw/0mG9oyDIvENYLUkSLlp8AYeW5w/PS/MRCXy3TEo9dr79+9r5mybLyD5l+Gz wd9Ep7FwwGldDwA04oWbQXA3Ni2VcYDcRRbE7zkjQKKqght16Az9nQUk8HGuhIGfjLmY M7im8E2VqV8K6OdOqLSt73s6Z0ajQ0A/R//pON154QDGNeU1LRaTERNXh3NceDgjeOkZ YfWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=Q7i/SuhfRkyOQClzZruP2jKe1RgloaqVXQlYpi8QVZA=; fh=0E/hMay0J5k9agk8WzIkmGTG9IiVB3P1F680TiBzPPs=; b=KanD1Q99pjKwNpPQemp6LiPd8X6/8iufmfQvaOda/RQXSQI/csGS3uHMH1BR+/GUT5 uL1JCAMIHRGdHSUmv67ILWuhnLLdyHSaYpSlQrK1RAoBq3MXmMETWqS3CDfhL705fkKJ xoh961O7TkfMEp0JNWVFwHg5GN7BI3sZ/V+fBsfyaM/ov3xMMmnD8iV61o/Rm0IzQDo7 SzBzPoatvSJm7N1rotoN1FIrRMK3l4e5bWVfd9DcTWmXCo5j0I8tPowYxmksrNCudcMz CiTc+4voGOKj10zyB+HjdI0p7KT2spddIF7ePBnGkyCTCGa/xLw1aKGcrKCjaRkDVniA WoOg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-30010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30010-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g15-20020a0ce4cf000000b00681781b21e8si3790593qvm.597.2024.01.18.02.33.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 02:33:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-30010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30010-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 290551C21E81 for ; Thu, 18 Jan 2024 10:33:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42F0120B23; Thu, 18 Jan 2024 10:33:48 +0000 (UTC) Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10B7720B04; Thu, 18 Jan 2024 10:33:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.78.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705574027; cv=none; b=O6uP4jcAYT8WY/rnXCZH0aTjXTy6449m2gaE9gCpv1i4BLGLaBcSUXWxVgX6l6fe7aWBBPhsvKbzCxHOwD5EvCk0CRra9uCIPBTB2YZxH4vFANyDP65wvnLAMPItuVZ0IW6hXs021+64teB+MNhTBhe8pVbhn35fDq1eLn/aYKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705574027; c=relaxed/simple; bh=15DiUnnoqFmJQ1n4F5shd8NZfrPHdiR0aqhLgWlJuJs=; h=Received:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To: User-Agent; b=eyQFJ88pLuZP5sl/dccs20JzopE7wrPn3QMqNjGSER0f/sM6kX/qPSrEe7qD7jp5zORf/rq3gnMRHGnV8tc9kaS+vhkHACdlca/jDyySIjeJobsS1J3Rnuf+fNYD0fnNxd6oQ12pl5aysN3R/NqEVHdns9zPHXll3x3nllRPmHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=83.223.78.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 9B90A28141EA3; Thu, 18 Jan 2024 11:33:35 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8FB0ECC6A0; Thu, 18 Jan 2024 11:33:35 +0100 (CET) Date: Thu, 18 Jan 2024 11:33:35 +0100 From: Lukas Wunner To: Vidya Sagar Cc: bhelgaas@google.com, alex.williamson@redhat.com, treding@nvidia.com, jonathanh@nvidia.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, vsethi@nvidia.com, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com Subject: Re: [PATCH V3] PCI: pciehp: Disable ACS Source Validation during hot-remove Message-ID: <20240118103335.GA29974@wunner.de> References: <20230111190533.29979-1-vidyas@nvidia.com> <20230730191519.3124390-1-vidyas@nvidia.com> <20230730194026.GA19962@wunner.de> <7880aa6e-9fc5-c026-138f-42bef3c48b69@nvidia.com> <20230731195930.GA13000@wunner.de> <20240108141901.GA17779@wunner.de> <7345c2d2-5446-49a6-9ceb-0f1b9ee4ec18@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7345c2d2-5446-49a6-9ceb-0f1b9ee4ec18@nvidia.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Jan 11, 2024 at 07:14:54PM +0530, Vidya Sagar wrote: > On 1/8/2024 7:49 PM, Lukas Wunner wrote: > > On Thu, Jan 04, 2024 at 08:01:06PM +0530, Vidya Sagar wrote: > > > On 8/1/2023 1:29 AM, Lukas Wunner wrote: > > > > As an alternative to disabling ACS, have you explored masking ACS > > > > Violations (PCI_ERR_UNC_ACSV) upon de-enumeration of a device and > > > > unmasking them after assignment of a bus number? > > > > > > I explored this option and it seemed to work as expected. But, the issue > > > is that this works only if the AER registers are owned by the OS. If the > > > AER registers are owned by the firmware (i.e. Firmware-First approach of > > > handling the errors), OS is not supposed to access the AER registers and > > > there is no indication from the OS to the firmware as to when the > > > enumeration is completed and time is apt to unmask the ACSViolation > > > errors in the AER's Uncorrectable Error Mask register. > > > Any thoughts on accommodating the Firmware-First approach also? I'm sorry, I don't have any good ideas. I just would like to avoid disabling ACS Source Validation because it would diminish our security posture. I guess setting the secondary bus number in the hotplug port to 0 isn't a good solution either because it would allow hotplugged devices to temporarily spoof TLPs from devices on the root bus, right? One option might be to have separate code paths: If AER is owned by the OS, mask PCI_ERR_UNC_ACSV on hot-removal, unmask on hot-add. If AER is *not* owned by the OS, disable ACS Source Validation on hot-removal, enable on hot-add, and warn loudly about the security implications. Another option might be to change error handling, i.e. ignore ACS Source Validation errors if they occur before assignment of a bus number. And temporarily disable DPC. None of these options look pretty. I'm generally not a fan of having the firmware own certain features. The user experience is better if everything is owned by the OS. This is just one more case in point. :( Thanks, Lukas