qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v7 27/51] i386/xen: Add support for Xen event channel deliver


From: David Woodhouse
Subject: Re: [PATCH v7 27/51] i386/xen: Add support for Xen event channel delivery to vCPU
Date: Tue, 17 Jan 2023 12:31:43 +0000
User-agent: Evolution 3.44.4-0ubuntu1

On Tue, 2023-01-17 at 11:11 +0000, Paul Durrant wrote:
> 
> Ick. Do we really want cross-block gotos? For me it would look a lot 
> nicer if you did a forward jump here and later and put the label+code
> after the `return 0`.

How's this?

static int set_vcpu_info(CPUState *cs, uint64_t gpa)
{
    X86CPU *cpu = X86_CPU(cs);
    CPUX86State *env = &cpu->env;
    MemoryRegionSection mrs = { .mr = NULL };
    void *vcpu_info_hva = NULL;
    int ret;

    ret = kvm_xen_set_vcpu_attr(cs, KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO, gpa);
    if (ret || gpa == INVALID_GPA) {
        goto out;
    }

    mrs = memory_region_find(get_system_memory(), gpa, sizeof(struct 
vcpu_info));
    if (!mrs.mr) {
        ret = -EINVAL;
    } else if (!mrs.mr->ram_block || mrs.size < sizeof(struct vcpu_info) ||
               !(vcpu_info_hva = qemu_map_ram_ptr(mrs.mr->ram_block,
                                                  mrs.offset_within_region))) {
        ret = -EINVAL;
        memory_region_unref(mrs.mr);
        mrs.mr = NULL;
    }

 out:
    if (env->xen_vcpu_info_mr) {
        memory_region_unref(env->xen_vcpu_info_mr);
    }
    env->xen_vcpu_info_hva = vcpu_info_hva;
    env->xen_vcpu_info_mr = mrs.mr;
    return ret;
}


Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]