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

Re: [PATCH] x86/vPIC: register only one ELCR handler instance


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 29 May 2023 10:39:14 +0200
  • 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=nu3VbNvYT/3P7tnAnz5ZryeArbkkmg+3pcEsfx5uZwk=; b=G6TM9ObRAaosUaAebq9xrXnGW8NCrFyXKcDAOjaK/KsEpXkmDv/vstvUKRhqLoJRtNAFEAzL5Z6pVm48ikoMlTlAXShIBpKslfPQq5dEWqjrb4gQ6qY5ulewflw4KzO6DAwTPsxK7+fvleG7KR36AAnixci5E5YEGpKGUXiABBuITODL98bkR+NEjAgsDTAvGQcuYMyxY8w9nTmoarbmuPkzjB+sY7F/ob26YuJYdU+cp8rGCGClwnxWOHDz4Ks7n54KLbOna8atMfYjOC4QXE8u0KbodmgSzYL5tPwjIeqD1iH2LEoMTty8v2p37XDzkcoMzxoYcyzv1ZiCdJIllQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gzgjkN+O6/2UiSLCs6XUNj2wnFmmZhcpT8vvOLEXfO4FU/3p8qlSzQhGQAqqNQL+ktvai4/RZJqy+fsd+fvITHxVoHJoHb7Q7tS1Z1OY19dCT84cHZlNpwuerz6M8kjdnXLUIoznxbzaPNM6nNweRBPd2frpdyYy9M+bFj8Y+BdOyXEANKp4UQj/NjG4l+vctXPJcaeVKZImgG7I1RdWtE27vaFgHB97Gm0X3BMvcYzNqDp6rYe0pX/uTluWdNlTA1Ax2xSrVqS2hdRW0xUqSAvzMuY6IRsBJ7eC8bs/bo/rXwwFbMj/2n45FB0bS1/Md0m7b9QLCV6sBqZ44B9vbw==
  • 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>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 29 May 2023 08:39:37 +0000
  • Ironport-data: A9a23:4x37vq6uEklCkFHhHtq7KwxRtB/GchMFZxGqfqrLsTDasY5as4F+v jNOCDvTPavbN2LxKNsjbYXi9EkOsJPWyIJgHlZkrCBkHi5G8cbLO4+Ufxz6V8+wwm8vb2o8t plDNYOQRCwQZiWBzvt4GuG59RGQ7YnRGvynTraCYnsrLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9lU35JwehBtC5gZlPa0R7AeE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5mz McjGgogLT25q+u8552lQdMrlOI4BZy+VG8fkikIITDxK98DGcqGb4CRoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OkkotjNABM/KMEjCObd9SkUuC4 HrP4kzyAw0ANczZwj2Amp6prraWxX2lA9hNTtVU8NZDg0ydgWMSLSctC2apvMK9px+PXfFAf hl8Fi0G6PJaGFaQZtv3UgC8oXWElgUBQNcWGOo/gCmdx6yR7wuHC2wsSj9adMdgpMIwXSYt1 FKCg5XuHzMHmKKRYWKQ8PGTtzzaBMQOBWoLZCtBQQ5e5dDm+Ns3lkiXEoolF7OphNroHz222 yqNsCU1m7QUi4gMyrm/+lfExTmro/AlUzII2+keZUr9hisRWWJvT9bABYTzhRqYELukcw==
  • Ironport-hdrordr: A9a23:NZxGWarLwHL+45F/wPcDxocaV5rUeYIsimQD101hICG9vPbo7P xG/c5rryMc5wxhP03I9erwXJVoBEmskKKdgrNhXotKPjOW3ldARbsKheCJrgEIWReOlNK1vp 0QCpSWZueAdWSSTvyU3OB7KbodKRW8kZyAtKPm1HFqQhhta6Z8qylEKivzKDwLeCB2QaMjEp yS/8xGoCflX082QICUOlkpNtKz2uEirvjdEGA77tocmXazZPqTht7HLyQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, May 26, 2023 at 09:35:04AM +0200, Jan Beulich wrote:
> There's no point consuming two port-I/O slots. Even less so considering
> that some real hardware permits both ports to be accessed in one go,
> emulating of which requires there to be only a single instance.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> --- a/xen/arch/x86/hvm/vpic.c
> +++ b/xen/arch/x86/hvm/vpic.c
> @@ -377,25 +377,34 @@ static int cf_check vpic_intercept_elcr_
>      int dir, unsigned int port, unsigned int bytes, uint32_t *val)
>  {
>      struct hvm_hw_vpic *vpic;
> -    uint32_t data;
> +    unsigned int data, shift = 0;
>  
> -    BUG_ON(bytes != 1);
> +    BUG_ON(bytes > 2 - (port & 1));
>  
>      vpic = &current->domain->arch.hvm.vpic[port & 1];
>  
> -    if ( dir == IOREQ_WRITE )
> -    {
> -        /* Some IRs are always edge trig. Slave IR is always level trig. */
> -        data = *val & vpic_elcr_mask(vpic);
> -        if ( vpic->is_master )
> -            data |= 1 << 2;
> -        vpic->elcr = data;
> -    }
> -    else
> -    {
> -        /* Reader should not see hardcoded level-triggered slave IR. */
> -        *val = vpic->elcr & vpic_elcr_mask(vpic);
> -    }
> +    do {
> +        if ( dir == IOREQ_WRITE )
> +        {
> +            /* Some IRs are always edge trig. Slave IR is always level trig. 
> */
> +            data = (*val >> shift) & vpic_elcr_mask(vpic);
> +            if ( vpic->is_master )
> +                data |= 1 << 2;

Not that you added this, but I'm confused.  The spec I'm reading
explicitly states that bits 0:2 are reserved and must be 0.

Is this some quirk of the specific chipset we aim to emulate?

Thanks, Roger.



 


Rackspace

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