Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp31556img; Wed, 27 Feb 2019 16:03:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IY7wF/Y6DJikt5Uot9qgBirvXLl7xgPC8J0EqUcQp0RCFEldnY7SgUKx8JuRSQNmrVOcvTQ X-Received: by 2002:a17:902:b70b:: with SMTP id d11mr5091979pls.178.1551312220926; Wed, 27 Feb 2019 16:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551312220; cv=none; d=google.com; s=arc-20160816; b=Pek6xk8aYKZ+i2IV8MUPFmE1nJBVuPUP+HOdbR1MH0Wt2nBVI/ZKlG0u9yUMuVginj b6H2AO4KkbrkyCKiOfd0TyVIerxILy0pyJQ0ytColu8kgUod0QDHKCjmRZTJ07I4SrPp DYN84Zdo5szGOcOTMDAqf8akn1PmFRBRxASBGqsaVSQoIcmfUo0JD8GhbFKay/rRRTlT 7DeCgs9cv0bf2yQiNuyuwXsSfF9XoRKu52VNTozKImIWESjp+Fis/zoyIPJvC4hlHDYx A7pgNMVPknZHhlxleq5kJtkz+Dzqs/9+uiAUQT/a03SLJuKxXnqFvbuHnaa2IllDKybD fPLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:cc:to:from:date:references :in-reply-to:message-id:user-agent:dkim-signature:dkim-signature; bh=K+DegNbvLP307hARvy97U1jKD+OQzjbATh22FbKGTHM=; b=r5KnOOJvif/+CABrWRvbJQW8ojf6vQDk+NaR1XsfnReAUAmOWaNBgFzb+XHEPQhM1Y QfC5iA1bzLdQi3yng37M+SK6SjSgV725qajQDiUzZETbV8Cv1Pvvc5kd9WzsYI8vjb8p lvMxWs8mBeN7PcOxgJuXg+Xd942ZZkkwopdLfSvHC9rIBHHQa2N0NlkfVvVrh3z+MppK A14T6QkX+hfNTgRVS+EAM4aW3yrzkcS/tncfMlDSw4n2GUXRd6UHlXKJlg4WfrNLZsWe u8ZQGow6GdhBu6aU4J+iypHbPAQ7GDR74QMwL0JA/sK/2047LLOxv1a7yARJgcpnjT3L H1PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=QBaZ3L8c; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=XDe6zVwz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si10988212pgl.277.2019.02.27.16.03.24; Wed, 27 Feb 2019 16:03:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@aj.id.au header.s=fm2 header.b=QBaZ3L8c; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=XDe6zVwz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730596AbfB1ABo (ORCPT + 99 others); Wed, 27 Feb 2019 19:01:44 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:54003 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728397AbfB1ABo (ORCPT ); Wed, 27 Feb 2019 19:01:44 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 31A51234B6; Wed, 27 Feb 2019 19:01:43 -0500 (EST) Received: from imap2 ([10.202.2.52]) by compute4.internal (MEProxy); Wed, 27 Feb 2019 19:01:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= message-id:in-reply-to:references:date:from:to:cc:subject :content-type; s=fm2; bh=K+DegNbvLP307hARvy97U1jKD+OQzjbATh22FbK GTHM=; b=QBaZ3L8cTMkXJJxcasULGDNBhJnhGwYcBZeUV1XFuppwkfTMUw/vcvW O7bHqXXJaGZjY44uRVjX5huZQs1yWQpKuNKM43queMNN/wStcq1ZSB2RYC/QwZnY R+9ejGS5g0wFljwZ9vmpE3pX0hg5co+Gwh+Af87Hx3p2E+EzrbSWeoh0brn6zAUf Tz086GZMSalbwUB3Ia2PlHp4A6a76XgNNl3fWiWfy74HjgaTA85maEqAPYxNvu0o 7kPlWH9PgWfq3VZspBfEgvsvh53WmLwJu36igsFNLrlYe3/NbXSYqVjnXCCckHjj /FARo7pSxgMVb8tuFi6d5G4hcdoRQLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=K+DegNbvLP307hARv y97U1jKD+OQzjbATh22FbKGTHM=; b=XDe6zVwzKgucRkF8ntO2cMV3TIYjG6uL0 +5fxUJI+Z4nx4H8gbiXD0fSaHwQCvYduV1KuUflLh1ASe+Zxwf8Rz177Sp+y5uwT 2SOV/8D/dxXDZ69I768dhXcM6zyiLttpgrnIuJ77UN47R2CCSSosygZdtWdiovvc FhX36+HE0z6sCo7etn/EUxWyPy7f3K6sNJzg39nirFBFf6hcQ4QcZpwDXDBufLfw xc4WcA7PeKWY34SqKXBZJqfFIn2C/HdOW432+s05iednAhywToZ84eZWJTRD2qxb ymAbXiPX+cRNlQ3Lm9/rU6tEwrtBLvvKRnnulYNbxox9S3yOGXr2Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrvddvgdduvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgurhgv ficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecurfgrrhgrmh epmhgrihhlfhhrohhmpegrnhgurhgvfiesrghjrdhiugdrrghunecuvehluhhsthgvrhfu ihiivgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 7BDD07C1EB; Wed, 27 Feb 2019 19:01:42 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.5-895-g0d23ba6-fmstable-20190213v1 X-Me-Personality: 52947553 Message-Id: <43124fcc-6560-4a30-8043-727c39e487ab@www.fastmail.com> In-Reply-To: <9ab3a0e6-fa1e-11c7-adad-7e14bfe28059@gmail.com> References: <20190221222537.137331-1-venture@google.com> <9ab3a0e6-fa1e-11c7-adad-7e14bfe28059@gmail.com> Date: Wed, 27 Feb 2019 19:01:41 -0500 From: "Andrew Jeffery" To: "Florian Fainelli" , "Patrick Venture" , "Arnd Bergmann" , "Greg Kroah-Hartman" , "Joel Stanley" Cc: linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/2] drivers/misc: Add Aspeed P2A control driver Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 Feb 2019, at 15:35, Florian Fainelli wrote: > > > On 2/21/2019 2:25 PM, Patrick Venture wrote: > > The ASPEED AST2400, and AST2500 in some configurations include a > > PCI-to-AHB MMIO bridge. This bridge allows a server to read and write > > in the BMC's memory space. This feature is especially useful when using > > this bridge to send large files to the BMC. > > > > The host may use this to send down a firmware image by staging data at a > > specific memory address, and in a coordinated effort with the BMC's > > software stack and kernel, transmit the bytes. > > > > This driver enables the BMC to unlock the PCI bridge on demand, and > > configure it via ioctl to allow the host to write bytes to an agreed > > upon location. In the primary use-case, the region to use is known > > apriori on the BMC, and the host requests this information. Once this > > request is received, the BMC's software stack will enable the bridge and > > the region and then using some software flow control (possibly via IPMI > > packets), copy the bytes down. Once the process is complete, the BMC > > will disable the bridge and unset any region involved. > > > > The default behavior of this bridge when present is: enabled and all > > regions marked read-write. This driver will fix the regions to be > > read-only and then disable the bridge entirely. > > A complete drive by review, so I could be completely off here (most > likely am), but have you considered using virtio and doing some sort of > rudimentary features (regions here) negotiation over that interface? > > If I get your description right in premise maybe emulating the AHB side > on the BMC as a PCI end-point device driver, and using it as a seemingly > regular PCI EP from the host side with BARs and stuff might make sense > here and be less of a security hole than it currently looks like. It's not immediately clear to me that this is a win; it seems like a lot of complexity that only prevents the host from accidentally stomping on areas of BMC RAM; a malicious host would just ignore this constraint anyway as the hardware capability allows access anywhere in the BMC's address space. Most of the accidental case is taken care of by Patrick's strategy anyway, which is disabling the capability entirely when there's no need for it to be active. Andrew