From patchwork Fri Aug 23 16:21:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 172115 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp885984ily; Fri, 23 Aug 2019 09:22:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwae4ynb4PTfsIL/jQai/TEoNFYlJFJoe2D+/GnjVfW+kPSXoyfpVnl7tG0QwHHtll2hHSg X-Received: by 2002:ac8:341d:: with SMTP id u29mr5371758qtb.320.1566577347375; Fri, 23 Aug 2019 09:22:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566577347; cv=none; d=google.com; s=arc-20160816; b=SrsjiUwsVQcT/JWgnjqr7h2eA4jtU7eWFJN+H+mA4dS03jzMYwyEf60P+UUuWYnwk3 WwhV/QbdoyZpR95JWsWB8fTHJaob3g+uhV8C5fYuiMXue2e6o05uOt+95VmV5gTSPNhW MO+hcQIT1mzQJ6BJWFK5mKcZ5vsrTmosvc7F6OQMWeCi6NzFPKhI+I2RiaLWrFITj3b1 UtwRlELnFzboFVTKBI1CT5T1JNA1WIAUwSl1j2El0sqI5lugfnvck8aDRYxu0Y/xDvNx eY2+KcdzSImKx8WNIBN7bIvGbs9gf/mfReaf+n6o/226+ykdPAvKSre3kZUoUgmBUu0j X+Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=x53LEDDYOGDvRskIUKw103kFla+HOQZzlWoA+lZTcYM=; b=IxXcfojXvE1H1eHxEwPf5AVrmm+UxnmeYfLh8ptHlLScUn0RamJujUksNPOlcZIg7B dGtzMnHG/L7cFx4sKUYIj8luDnTmSsbPXmvYxVzrBW0Nq7nNtONwN/ksGyItd2Bn0v2t QYaNqzv66DQMFnQYUHoOKzqb3x9VjNuWEv4ojzCt8LY6a7jI4xq4XIpm9uY6KRTF1urO KB4bB+lY6/mVIArUcSwmtSkrgXShivHJmcxaFFN9iH+LEekPhUnsgtLjfcI3Y0yz/yI6 Nj0DIbwnOXEzkU8td8UUJi+Ut4qKPuUN+PBPMD/Gfn6FpT1ZFJYMpm/W65iDrviU5W3T Z+iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id t5si2187393qkh.43.2019.08.23.09.22.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Aug 2019 09:22:27 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFBB818C427C; Fri, 23 Aug 2019 16:22:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8CA86012D; Fri, 23 Aug 2019 16:22:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 79BB724F33; Fri, 23 Aug 2019 16:22:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7NGM6rW005999 for ; Fri, 23 Aug 2019 12:22:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49DE360628; Fri, 23 Aug 2019 16:22:06 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-122-169.rdu2.redhat.com [10.10.122.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC01260872; Fri, 23 Aug 2019 16:22:05 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 23 Aug 2019 12:21:48 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [libvirt] [PATCH v2 04/16] qemu-cgroup: allow accel rendernode access X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Fri, 23 Aug 2019 16:22:26 +0000 (UTC) From: Marc-André Lureau Signed-off-by: Marc-André Lureau Signed-off-by: Cole Robinson Reviewed-by: Ján Tomko --- src/qemu/qemu_cgroup.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index ecd96efb0a..eb6f993d8e 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -503,6 +503,25 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm, } +static int +qemuSetupVideoAccelCgroup(virDomainObjPtr vm, + virDomainVideoAccelDefPtr def) +{ + qemuDomainObjPrivatePtr priv = vm->privateData; + int ret; + + if (!def->rendernode || + !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES)) + return 0; + + ret = virCgroupAllowDevicePath(priv->cgroup, def->rendernode, + VIR_CGROUP_DEVICE_RW, false); + virDomainAuditCgroupPath(vm, priv->cgroup, "allow", def->rendernode, + "rw", ret); + return ret; +} + + static int qemuSetupBlkioCgroup(virDomainObjPtr vm) { @@ -803,6 +822,11 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm) goto cleanup; } + for (i = 0; i < vm->def->nvideos; i++) { + if (qemuSetupVideoAccelCgroup(vm, vm->def->videos[i]->accel) < 0) + goto cleanup; + } + for (i = 0; i < vm->def->ninputs; i++) { if (qemuSetupInputCgroup(vm, vm->def->inputs[i]) < 0) goto cleanup;