On 7/25/19 7:22 AM, Jan Kiszka wrote:
> On 13.07.19 20:10, Ralf Ramsauer wrote:
>> They're now basically the same. Consolidate it.
>>
>> Signed-off-by: Ralf Ramsauer <[email protected]>
>> ---
>>  hypervisor/arch/x86/include/asm/vcpu.h |  2 --
>>  hypervisor/arch/x86/svm.c              |  7 -------
>>  hypervisor/arch/x86/vcpu.c             | 13 ++++++++++---
>>  hypervisor/arch/x86/vmx.c              |  7 -------
>>  4 files changed, 10 insertions(+), 19 deletions(-)
>>
>> diff --git a/hypervisor/arch/x86/include/asm/vcpu.h 
>> b/hypervisor/arch/x86/include/asm/vcpu.h
>> index 24872f55..cae5b554 100644
>> --- a/hypervisor/arch/x86/include/asm/vcpu.h
>> +++ b/hypervisor/arch/x86/include/asm/vcpu.h
>> @@ -88,8 +88,6 @@ const u8 *vcpu_get_inst_bytes(const struct 
>> guest_paging_structures *pg_structs,
>>  
>>  void vcpu_skip_emulated_instruction(unsigned int inst_len);
>>  
>> -void vcpu_vendor_get_cell_io_bitmap(struct cell *cell,
>> -                                struct vcpu_io_bitmap *out);
>>  unsigned int vcpu_vendor_get_io_bitmap_pages(void);
>>  
>>  #define VCPU_CS_DPL_MASK    BIT_MASK(6, 5)
>> diff --git a/hypervisor/arch/x86/svm.c b/hypervisor/arch/x86/svm.c
>> index f2ea313e..e1000447 100644
>> --- a/hypervisor/arch/x86/svm.c
>> +++ b/hypervisor/arch/x86/svm.c
>> @@ -1008,13 +1008,6 @@ const u8 *vcpu_get_inst_bytes(const struct 
>> guest_paging_structures *pg_structs,
>>      }
>>  }
>>  
>> -void vcpu_vendor_get_cell_io_bitmap(struct cell *cell,
>> -                                struct vcpu_io_bitmap *iobm)
>> -{
>> -    iobm->data = cell->arch.io_bitmap;
>> -    iobm->size = IOPM_PAGES * PAGE_SIZE;
>> -}
>> -
>>  unsigned int vcpu_vendor_get_io_bitmap_pages(void)
>>  {
>>      return IOPM_PAGES;
>> diff --git a/hypervisor/arch/x86/vcpu.c b/hypervisor/arch/x86/vcpu.c
>> index 4c074669..cf8ff04c 100644
>> --- a/hypervisor/arch/x86/vcpu.c
>> +++ b/hypervisor/arch/x86/vcpu.c
>> @@ -76,6 +76,13 @@ out_err:
>>      return NULL;
>>  }
>>  
>> +static inline void vcpu_get_cell_io_bitmap(struct cell *cell,
>> +                                       struct vcpu_io_bitmap *iobm)
>> +{
>> +    iobm->data = cell->arch.io_bitmap;
>> +    iobm->size = vcpu_vendor_get_io_bitmap_pages() * PAGE_SIZE;
>> +}
>> +
>>  int vcpu_cell_init(struct cell *cell)
>>  {
>>      const unsigned int io_bitmap_pages = vcpu_vendor_get_io_bitmap_pages();
>> @@ -97,7 +104,7 @@ int vcpu_cell_init(struct cell *cell)
>>              return err;
>>      }
>>  
>> -    vcpu_vendor_get_cell_io_bitmap(cell, &cell_iobm);
>> +    vcpu_get_cell_io_bitmap(cell, &cell_iobm);
>>  
>>      /* initialize io bitmap to trap all accesses */
>>      memset(cell_iobm.data, -1, cell_iobm.size);
>> @@ -115,7 +122,7 @@ int vcpu_cell_init(struct cell *cell)
>>               * Shrink PIO access of root cell corresponding to new cell's
>>               * access rights.
>>               */
>> -            vcpu_vendor_get_cell_io_bitmap(&root_cell, &root_cell_iobm);
>> +            vcpu_get_cell_io_bitmap(&root_cell, &root_cell_iobm);
>>              pio_bitmap = jailhouse_cell_pio_bitmap(cell->config);
>>              for (b = root_cell_iobm.data; pio_bitmap_size > 0;
>>                   b++, pio_bitmap++, pio_bitmap_size--)
>> @@ -143,7 +150,7 @@ void vcpu_cell_exit(struct cell *cell)
>>      struct vcpu_io_bitmap root_cell_iobm;
>>      u8 *b;
>>  
>> -    vcpu_vendor_get_cell_io_bitmap(&root_cell, &root_cell_iobm);
>> +    vcpu_get_cell_io_bitmap(&root_cell, &root_cell_iobm);
>>  
>>      if (root_cell.config->pio_bitmap_size < pio_bitmap_size)
>>              pio_bitmap_size = root_cell.config->pio_bitmap_size;
>> diff --git a/hypervisor/arch/x86/vmx.c b/hypervisor/arch/x86/vmx.c
>> index 8552cabd..2f46b7e9 100644
>> --- a/hypervisor/arch/x86/vmx.c
>> +++ b/hypervisor/arch/x86/vmx.c
>> @@ -1220,13 +1220,6 @@ void vmx_entry_failure(void)
>>      panic_stop();
>>  }
>>  
>> -void vcpu_vendor_get_cell_io_bitmap(struct cell *cell,
>> -                                struct vcpu_io_bitmap *iobm)
>> -{
>> -    iobm->data = cell->arch.io_bitmap;
>> -    iobm->size = PIO_BITMAP_PAGES * PAGE_SIZE;
>> -}
>> -
>>  unsigned int vcpu_vendor_get_io_bitmap_pages(void)
>>  {
>>      return PIO_BITMAP_PAGES;
>>
> 
> This is pointing in the right direction, but we can be more aggressive: There 
> is
> no reason for struct vcpu_io_bitmap anymore. pio_allow_access() will only use
> the data, and for the users here, we also remove the indirection without
> complicating things.

Good point! I already implemented the removal of the structure. I'll put
this at the end of my series. This makes it easier for me.

  Ralf

> 
> Jan
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/57ef7def-c89e-11ad-050f-66a2e892889d%40oth-regensburg.de.

Reply via email to