lkml.org 
[lkml]   [2015]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 07/13] KVM: add vcpu-specific functions to read/write/translate GFNs


On 29/05/2015 21:23, Radim Krčmář wrote:
>> > +int kvm_vcpu_write_guest(struct kvm_vcpu *vcpu, gpa_t gpa, const void *data,
>> > + unsigned long len)
>> > +{
>> > + gfn_t gfn = gpa >> PAGE_SHIFT;
>> > + int seg;
>> > + int offset = offset_in_page(gpa);
>> > + int ret;
>> > +
>> > + while ((seg = next_segment(len, offset)) != 0) {
>> > + ret = kvm_vcpu_write_guest_page(vcpu, gfn, data, offset, seg);
>> > + if (ret < 0)
>> > + return ret;
>> > + offset = 0;
>> > + len -= seg;
>> > + data += seg;
>> > + ++gfn;
>> > + }
>> > + return 0;
>> > +}
> (There is no need to pass vcpu, and kvm, in this API.

How so? A single kvm_vcpu_write_guest can cross multiple slots.

Paolo

> Extracting memslots early will help to keep more code common.
>
> I have patches that did a superset of this for the old API, so posting
> them after this series is finalized will be simple.)


\
 
 \ /
  Last update: 2015-06-05 12:41    [W:0.151 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site