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

Re: [PATCH v2] libs/foreignmemory: Implement on NetBSD


  • To: Manuel Bouyer <bouyer@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 28 Jan 2021 11:42:45 +0000
  • 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-SenderADCheck; bh=Y074VSS6ebpd/+QbaEAkvXbyJg6BpZHtx8MuzaNh43w=; b=A2xtcn95t6WYTjnC4ZRPfehTe/5B4KnufMRQ6LA3TXKyfM9W7rNS7BhYysITYnuH7nqLw171ulznEpu+7W8vGPMqcaXq9f3TV3T6LV2xsgzw2FKyJa3nyvyfXOVFSLZdPzFGAZZhyq2fqyVlMnclzXKwwwCLlbSAIu4O3qlhJi70btWOdS/HMdt+jHeGar+TG8Zqyi767MXRRLxNPzgfEtK+UZ2YWV2JIvRA/p2QWRzXGYnxW6u/gz8QbNjuK2zKfH1aY1NWHXQlICBstQvJf74kVOgNFMD6hxEpgq5c30hqFGvBeySBe1zU9wxelm6XcFkmLJj1UJLKpBBI8VwdQw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ktbcnwXclNsknBwCIW8SOFGQf7TzuqjFvYKzY796aDWZdShrgmo8T/mbux80e1J9zQQxcTcUgl1WN2sYaiodOW7BEsxjQUn/c8Vd7Voe0RmIaRAiTboj+zv/DTnpzw+9QY8GveQSe45Pfiy/OaeVnbRCHsUnjV/cEynwlypMvhinIfZT+FcFs6Z5nY2WdTJRC717FNpbgUCufJZo9+UYjZOT7qELk3CiU+9jXq0gzIDwSjvrNuGa5aAyA1/XaEjAWrFQFRyHm0ME1e2Qlp/S29GYxdwJRWxxAILRaPEs8kZ3lijOl2qdZ/PMEvrJbgwfBR/xKPP0THgNMal7S/FJHg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Thu, 28 Jan 2021 11:42:57 +0000
  • Ironport-sdr: kkcmagkyHsE/MV95Vl06sn7W6GunRZ4pPuXlPiY7XMPvB9KxncoECBqz+sPWHMz7QP5pMtOUHK iZNnYtVDy6CIBrS99e+BDDZIfNxr7TXDjwZU+Vwi5FWG+C936I4oAXFclGpTbq0t3yaE7eqLih rJQOC5lg3b00LWc760Ky7IFEFaWcruYtJHixOUOhDj7VKIBP4eCOZ/2gkOjcTIhsHuIXonc8aO AwJdTzKZtP7XN8ZXsIb7YDVcTv9iD4O0fEepKkku7W1VA4c89SA+5BGO8P6aDsYBMUGb6CcHy5 ID8=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28/01/2021 10:52, Andrew Cooper wrote:
> On 26/01/2021 22:47, Manuel Bouyer wrote:
>> diff --git a/tools/libs/foreignmemory/netbsd.c 
>> b/tools/libs/foreignmemory/netbsd.c
>> index 54a418ebd6..a7e1d72ffc 100644
>> --- a/tools/libs/foreignmemory/netbsd.c
>> +++ b/tools/libs/foreignmemory/netbsd.c
>> @@ -97,7 +102,48 @@ void *osdep_map_foreign_batch(xenforeignmem_handle 
>> *fmem, uint32_t dom,
>>  int osdep_xenforeignmemory_unmap(xenforeignmemory_handle *fmem,
>>                                   void *addr, size_t num)
>>  {
>> -    return munmap(addr, num*XC_PAGE_SIZE);
>> +    return munmap(addr, num*PAGE_SIZE);
>> +}
>> +
>> +int osdep_xenforeignmemory_restrict(xenforeignmemory_handle *fmem,
>> +                                    domid_t domid)
>> +{
>> +    errno = EOPNOTSUPP;
>> +    return -1;
>> +}
>> +
>> +int osdep_xenforeignmemory_unmap_resource(
>> +    xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
>> +{
>> +    return fres ? munmap(fres->addr, fres->nr_frames << PAGE_SHIFT) : 0;
>> +}
>> +
>> +int osdep_xenforeignmemory_map_resource(
>> +    xenforeignmemory_handle *fmem, xenforeignmemory_resource_handle *fres)
>> +{
>> +    privcmd_mmap_resource_t mr = {
>> +        .dom = fres->domid,
>> +        .type = fres->type,
>> +        .id = fres->id,
>> +        .idx = fres->frame,
>> +        .num = fres->nr_frames,
>> +    };
>> +    int rc;
>> +
>> +    fres->addr = mmap(fres->addr, fres->nr_frames << PAGE_SHIFT,
>> +                      fres->prot, fres->flags | MAP_ANON | MAP_SHARED, -1, 
>> 0);
>> +    if ( fres->addr == MAP_FAILED )
>> +        return -1;
>> +
>> +    mr.addr = (uintptr_t)fres->addr;
>> +
>> +    rc = ioctl(fmem->fd, IOCTL_PRIVCMD_MMAP_RESOURCE, &mr);
>> +    if ( rc )
>> +    {
>> +        PERROR("ioctl failed");
> return -1;
>
> I was rebasing my resource_size fix over this patch.
>
> It would be easiest for me if I fix up and commit this patch, if
> everyone is happy with that.

FAOD I've committed a fixed up version of this patch as discussed.

~Andrew



 


Rackspace

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