[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2] x86/vpci: refuse to map BARs at position 0


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Stewart Hildebrand <stewart.hildebrand@xxxxxxx>
  • Date: Thu, 22 May 2025 11:44:24 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=eHwft3HEcPANxL9VLsIeuPPFsrYsAWz/qnq5FcH6Eko=; b=RnXONPhKj3EaEA1DTn/ToQrN82dr4UrU10BP80mgdz+seI0sx2tCBEk22Bg+da8/mJXaehwanUIMoPZu/SjCm9mHQKsLE/S5MZgk3TVuyeC5LmQen6EDPk8kVyD8LN3srRJKbSz0XLM1xSD+vBCp4GeCkXLk3aBppDvJndd7zLwuODZFIMz6zg78S1Q4tAPvTDMaZkHsme1DTgM5083ZO/CaZQmm8TAxjoZrQs6M+Ig/6Xj84oVy4GLRCE7sqMLbtXUW+n4Yg+GXtSukHLRAaQ2VOSwRHl2hJFofIzSu4hi75l+ThoPAvgpsLAyGGeWm56sqIPmrUaWTpd/he7RwPg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=oI5G+pclb17yxaM7baF4BXrqsKu8kG54J+GaR8NnGWw4wVggHDmWVyuH2avKv1NMN9F9XbE5TJPOewhKztskCuuNemnSiNEe1BIE4xMjJHVQAQioYdl+juxeKrHj+aXOL3zOi1BQVkHUtVqpDBrpvTkJl1HjwpHTo9/EjjmV7ViUE7s54VCFYRZ4XC3KFyblGgSudcEITilhmQUh4aIgUaBOT34e/0UDhLiaKFAG3utLbddRnw/2Zxh1bNqIZUJL9dpOlUHrD9oppj9uWvu0MS2LbaQJm/D8Xat2HtEVpteSo3Z9xd/DJWQxQoiI31wKuy4DE4FLISTbOS7JhM0A5g==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 22 May 2025 15:44:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 5/22/25 10:59, Jan Beulich wrote:
> On 22.05.2025 16:03, Roger Pau Monne wrote:
>> diff --git a/xen/arch/x86/pci.c b/xen/arch/x86/pci.c
>> index 26bb7f6a3c3a..39fd5a16a4aa 100644
>> --- a/xen/arch/x86/pci.c
>> +++ b/xen/arch/x86/pci.c
>> @@ -101,6 +101,15 @@ int pci_conf_write_intercept(unsigned int seg, unsigned 
>> int bdf,
>>  
>>  bool pci_check_bar(const struct pci_dev *pdev, mfn_t start, mfn_t end)
>>  {
>> +    /*
>> +     * Refuse to map BARs at position 0, those are not initialized.  This 
>> might
>> +     * be required by Linux, that can reposition BARs with memory decoding
>> +     * enabled.  By returning false here bar->enabled will be set to false, 
>> and
>> +     * bar_write() will work as expected.
>> +     */
>> +    if ( mfn_eq(start, _mfn(0)) )
>> +        return false;
> 
> Is this really x86-specific?

No, I think Arm would benefit from this check too. I'm in favor of
moving the check to common.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.