)]}'
{
  "commit": "55ea47397d07db2eb67cb7e86b4e7772098ece5f",
  "tree": "14fe6e38fe89bcb2993afb41d43cd4bdeffed538",
  "parents": [
    "36df75a0a903c8ba3e2e28eb7162c43f8dd5d8f0"
  ],
  "author": {
    "name": "Daniel Henrique Barboza",
    "email": "dbarboza@ventanamicro.com",
    "time": "Mon Jul 17 12:41:41 2023 -0300"
  },
  "committer": {
    "name": "Alistair Francis",
    "email": "alistair.francis@wdc.com",
    "time": "Wed Jul 19 14:30:52 2023 +1000"
  },
  "message": "target/riscv/cpu.c: check priv_ver before auto-enable zca/zcd/zcf\n\nCommit bd30559568 made changes in how we\u0027re checking and disabling\nextensions based on env-\u003epriv_ver. One of the changes was to move the\nextension disablement code to the end of realize(), being able to\ndisable extensions after we\u0027ve auto-enabled some of them.\n\nAn unfortunate side effect of this change started to happen with CPUs\nthat has an older priv version, like sifive-u54. Starting on commit\n2288a5ce43e5 we\u0027re auto-enabling zca, zcd and zcf if RVC is enabled,\nbut these extensions are priv version 1.12.0. When running a cpu that\nhas an older priv ver (like sifive-u54) the user is spammed with\nwarnings like these:\n\nqemu-system-riscv64: warning: disabling zca extension for hart 0x0000000000000000 because privilege spec version does not match\nqemu-system-riscv64: warning: disabling zcd extension for hart 0x0000000000000000 because privilege spec version does not match\n\nThe warnings are part of the code that disables the extension, but in this\ncase we\u0027re throwing user warnings for stuff that we enabled on our own,\nwithout user intervention. Users are left wondering what they did wrong.\n\nA quick 8.1 fix for this nuisance is to check the CPU priv spec before\nauto-enabling zca/zcd/zcf. A more appropriate fix will include a more\nrobust framework that will account for both priv_ver and user choice\nwhen auto-enabling/disabling extensions, but for 8.1 we\u0027ll make it do\nwith this simple check.\n\nIt\u0027s also worth noticing that this is the only case where we\u0027re\nauto-enabling extensions based on a criteria (in this case RVC) that\ndoesn\u0027t match the priv spec of the extensions we\u0027re enabling. There\u0027s no\nneed for more 8.1 band-aids.\n\nCc: Conor Dooley \u003cconor@kernel.org\u003e\nFixes: 2288a5ce43e5 (\"target/riscv: add cfg properties for Zc* extension\")\nSigned-off-by: Daniel Henrique Barboza \u003cdbarboza@ventanamicro.com\u003e\nReviewed-by: Alistair Francis \u003calistair.francis@wdc.com\u003e\nReviewed-by: Weiwei Li \u003cliweiwei@iscas.ac.cn\u003e\nTested-by: Conor Dooley \u003cconor.dooley@microchip.com\u003e\nMessage-Id: \u003c20230717154141.60898-1-dbarboza@ventanamicro.com\u003e\nSigned-off-by: Alistair Francis \u003calistair.francis@wdc.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9339c0241d6fc201b81c0a47106c33f73ce7757e",
      "old_mode": 33188,
      "old_path": "target/riscv/cpu.c",
      "new_id": "6b93b04453c8cb827aa90d63ba8947f1ad26bc3f",
      "new_mode": 33188,
      "new_path": "target/riscv/cpu.c"
    }
  ]
}
