[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] xen/pt: Avoid initializing BARs from the host ones
- To: Roger Pau Monne <roger.pau@xxxxxxxxxx>
- From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- Date: Mon, 9 May 2022 10:39:32 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- 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=2jD1O5zLnOSIsMU/9++7kis5g3HRa9EjhEyeVhDByHY=; b=Z5Dz+DgcEMvfCmEtSRHG8jKq3E3+yugDdeIZ3NCxjk6x0Re4Mosn/HEic9vTh09ZdLN6rMc+57wOyzgPqj87bzgU8e4DC+ZT8UpNLk8FB5eyidnYOmwH0+SVp6+xlsNZ2uEsqQY+JwZcLRm6JAkz2H9bkPygxECbePBJi0Wkaf9yuWFo8+LRgURqK2AX9t/srOrPDATkXrzNYUIY9Mu4sC9UCD0WZ+QKfsyRYH2vib0s+Z61QxGJvV2xKRSJxfRiBVyGx+sliyL1Hsy5ek3w3L5f3kAwGnvOOMhq0cg8NLMED8YAYczwwaNiVFk/m51wQrEcy96bjDcXbLHq64mf8A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PBTgzUi4QlX+Gxk3RyC1OMWndfsKkkWb/W0H7EERxfBDxDBjZww7emJubWCT+rC7ei5ZgnKFJ6knI9XYWuwXtRGY3Qwtw1oC+xaG/R6sXyOvI47uDa97AA2YnBjw5mpAJ6iN/G92VCgyq3Rf0S2dPkve4ufdcRTFmItwBcCCthWcF9WbSgXSqpQX9aaSAMepsmPuSUijinb1JU2ooYKNTKHHyIdtKNOkQy//cmwVrAt23I4eUEWOKCofB3i11qttQpHZHr5Dq9JMr05/T+GJY+iR19aq2Z4oBYLP7TWIkBAr8O/pUmqLxnaTd1FrIr02Y2rzBt3YX+4yH8pp7Wl2Qw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony Perard <anthony.perard@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, "qemu-devel@xxxxxxxxxx" <qemu-devel@xxxxxxxxxx>
- Delivery-date: Mon, 09 May 2022 10:39:46 +0000
- Ironport-data: A9a23:3knHEK4JdIDcnFqO3SxawwxRtCnGchMFZxGqfqrLsTDasY5as4F+v jEWCmmBM6qCamr2f911O420phwP7cCBnIU2Tgc9rH80Hi5G8cbLO4+Ufxz6V8+wwmwvb67FA +E2MISowBUcFyeEzvuVGuG96yE6j8lkf5KkYAL+EnkZqTRMFWFw0HqPp8Zj2tQy2YXhUlvU0 T/Pi5a31GGNimYc3l08s8pvmDs31BglkGpF1rCWTakjUG72zxH5PrpGTU2CByKQrr1vNvy7X 47+IISRpQs1yfuP5uSNyd4XemVSKlLb0JPnZnB+A8BOiTAazsA+PzpS2FPxpi67hh3Q9+2dx umhurSqES0qJI+cvN08WkZWOQRTDLJl5OX+dC3XXcy7lyUqclPK6tA3VgQcG91d/ex6R2ZT6 fYfNTYBKAiZgP67y666Te8qgdk/KM7sP8UUvXQIITPxVK56B8ycBfiXo4YGjV/chegXdRraT 9AeciEpaB3PbgdQM1MTIJk/gP2plj/0dDgwRFe9+vJovzSCnFIZPL7FFOuSYfmDfNhvl1+h/ G//2Tj6PA8EHYnKodaC2jf27gPVpgvrVYRXGLCm+/pChFyI2ndVGBAQTUG8o/Sylgi5Qd03A 1cP5iMkoKw29UqqZtrwRRu1pDiDpBF0c8JZDukS+AyLjK3O7G6xH2UBU3tNZcIrsOcwQjol0 ELPmMnmbQGDq5WQQHOZs72S/TW7PHFPKXdYPHFVCwwY/9PkvYc/yArVScpuG7K0iduzHizsx zeNr241gLB7YdM36phXNGvv21qEzqUlhCZsjukLdgpJNj9EWbM=
- Ironport-hdrordr: A9a23:bB/7/qA5ozu/C/3lHegOsceALOsnbusQ8zAXPh9KJCC9I/bzqy nxpp8mPEfP+U0ssHFJo6HiBEDyewKnyXcT2/hcAV7CZniqhILMFu1fBOTZslrd8kHFl9K1kJ 0QC5SWa+eAQmSS7/yKhjVQeuxIqLbozEnrv5am854Hd3AJV0gU1XYcNu/tKDwSeOApP/oEPa vZwvACiyureHwRYMj+LGICRfL/q9rCk4+jSQIaBjY8gTP+zA+A2frfKVy1zx0eWzRAzfMJ6m 7eiTH04a2lrrWS1gLc7WnO9J5b8eGRiuerRfb8yfT9GA+czzpAV74RH4FqewpF591H3Wxa0u UkZS1QefibpUmhJ11d6iGdpjUImAxel0MKj2Xoz0cL6PaJOg7TB6d69P1kWwqc5Ew6sN5m1q VXm2qfqppMFBvF2D/w/t7SSnhR5wKJSFcZ4JguZkZkIMIjgX5q3P4i1VIQFI1FEDPx6YghHu UrBMbA5OxOeVffa3zCpGFgzNGlQ3x2R369MwI/k93Q1yITkGFyzkMeysBalnAc9IglQ50B4+ jfKKxnmLxHU8dTZ6NgA+UKR9exFwX2MFnxGXPXJU6iGLAMOnrLpZKy6LIp5PuycJhN15c2kI SpaiIuiYfzQTObNSSj5uw6zvmWehTNYd3E8LAs27Fp/rvhWbHsLSqPDFgzjsrImYRrPvHm
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Msip_labels:
- Thread-index: AQHYWlVI6k4vzeGas0CbAgtnJ0rrZq0WWb2AgAAQ5LU=
- Thread-topic: [PATCH] xen/pt: Avoid initializing BARs from the host ones
> From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
> Sent: Monday, May 9, 2022 10:28 AM
> To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx <xen-devel@xxxxxxxxxxxxxxxxxxxx>; Stefano
> Stabellini <sstabellini@xxxxxxxxxx>; Anthony Perard
> <anthony.perard@xxxxxxxxxx>; Paul Durrant <paul@xxxxxxx>;
> qemu-devel@xxxxxxxxxx <qemu-devel@xxxxxxxxxx>
> Subject: Re: [PATCH] xen/pt: Avoid initializing BARs from the host ones
>
> On Wed, Apr 27, 2022 at 05:38:12PM +0100, Ross Lagerwall via wrote:
> > The BAR emulated register definition does not set emu_mask because it
> > varies depending on bar_flag. If emu_mask is not set, then the BAR is
> > initialized based on the host value which causes the BAR to be initially
> > mapped at whatever value the host device was using. Although it does
> > eventually get mapped at the correct location, it causes unnecessary
> > mapping/unmappings.
>
> Would it be possible to just unset the memory decoding bit in the
> command register if it's set?
I don't think that would be sufficient since AFAICT qemu does not read that
bit so will still call into Xen to update memory mappings, etc.
>
> > To fix this, initialize a per-register emu_mask in XenPTReg from the
> > initial value in XenPTRegInfo and then let the register's init() function
> > set/modify the emu_mask if necessary. Update the code to use emu_mask
> > in XenPTReg consistently and rename the existing emu_mask in
> > XenPTRegInfo to emu_mask_init to help with refactoring.
>
> Iff we really need this refactoring it would better be done in a
> separate (pre)patch, so it's clear what's the fix and what are
> refactoring changes.
>
> I also wonder whether why it isn't enough to set emu_mask in
> xen_pt_bar_reg_init(), without having to introduce a new field.
>
That doesn't work since emu_mask is part of xen_pt_emu_reg_header0 which
is static and is not defined per passthrough device so having multiple
passthrough devices would cause issues.
I have an idea to achieve the same result with less code churn so I'll
try it and send an updated patch.
Ross
|