lkml.org 
[lkml]   [2011]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 04/22] KVM: x86: introduce vcpu_gva_to_gpa to cleanup the code
On Wed, Jun 29, 2011 at 02:26:14PM +0300, Avi Kivity wrote:
> On 06/29/2011 02:26 PM, Xiao Guangrong wrote:
> >On 06/29/2011 07:09 PM, Avi Kivity wrote:
> >> On 06/29/2011 01:56 PM, Xiao Guangrong wrote:
> >>> On 06/29/2011 04:24 PM, Avi Kivity wrote:
> >>>
> >>> >> +static int vcpu_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva,
> >>> >> + gpa_t *gpa, struct x86_exception *exception,
> >>> >> + bool write)
> >>> >> +{
> >>> >> + u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0;
> >>> >> +
> >>> >> + if (write)
> >>> >> + access |= PFERR_WRITE_MASK;
> >>> >
> >>> > Needs fetch as well so NX/SMEP can work.
> >>> >
> >>>
> >>> This function is only used by read/write emulator, execute permission is
> >>> not needed for read/write, no?
> >>
> >> It's not good to have a function which only implements the functionality partially. It can later be misused.
> >>
> >> You can pass the page-fault-error-code instead of the write parameter, I think it will be simpler.
> >>
> >
> >Actually, we will get the cache mmio info in this function, i think it is pure waste for other
> >access execpt mmio, what about change the function name to vcpu_gva_to_gpa_mmio?
>
> Not too happy, but ok.
>
I do plan to add fetching from MMIO.

--
Gleb.


\
 
 \ /
  Last update: 2011-06-29 13:51    [W:0.077 / U:0.332 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site